vbscript - Running a .vbs file from .bat with variable path -


i'm trying run .vbs file through batch program (.bat). catch .vbs file , .bat file in different directories. also, want use variable path user can launch .bat program through correct directory.

a simple version of .bat script like:

cscript "c:\users\username\directory\file.vbs" 

but, want use variable directory looks this:

cscript %variable% test.vbs 

here's have far:

for /f "tokens=3 delims=\" %%a in ("%cd%") set user=%%a set "base=c:\users\" set "end=\folder 1\folder 2\" set "basepath = %base%%user%%end%" set "vbsname=test.vbs" cscript %basepath% %vbsname% pause 

the "users" directory of current user available in userprofile environment variable. following run .vbs file batch file:

cscript "%userprofile%\folder 1\folder 2\test.vbs" 

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -