1
votes

So im trying to open a .vbs file with a .bat file (the vbs file is in the same folder as the bat file)

start %~dp0 req.vbs

but when i run the batch i get this when it tries to open reg.vbs image here

would not let me add a gyazo image)

i dont know how to get it to open the vbs file properly

3
Looking your image I see the File: Gage specification there. Where the Gage name comes from? FYI: in my OS another Open with dialogue appears so I can't reproduce your issue satisfactorily.JosefZ
I see a space in start %~dp0 req.vbs between %~dp0 and req.vbs. Try start %~dp0req.vbs or start "" "%~dp0req.vbs"JosefZ
ware able to open the vbs file?0m3r

3 Answers

1
votes

try with (output will be in the console)

cscript /nologo /e:vbscript req.vbs

or (output will be with annoying pop-ups)

wscript /e:vbscript req.vbs
1
votes

Check the %PATHEXT% system environment variable: set PATHEXT command should return a list of recognized executable file extensions and should contain the .VBS, for instance as follows:

==>set pathext
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

Check file association using assoc and ftype commands as follows:

==>assoc .vbs
.vbs=VBSFile

==>ftype VBSFile
VBSFile="%SystemRoot%\System32\WScript.exe" "%1" %*

To re-establish the link between the .vbs FileType and an executable program (note that cmd should be run as administrator and the operating sequence matters):

ftype VBSFile="%SystemRoot%\System32\WScript.exe" "%1" %*
assoc .vbs=VBSFile

or

ftype VBSFile="%SystemRoot%\System32\CScript.exe" "%1" %*
assoc .vbs=VBSFile

If you are using above commands from a batch script then double percent signs in "%%1" and %%* as follows:

ftype VBSFile="%SystemRoot%\System32\WScript.exe" "%%1" %%*
assoc .vbs=VBSFile

or

ftype VBSFile="%SystemRoot%\System32\CScript.exe" "%%1" %%*
assoc .vbs=VBSFile
0
votes

You can use PUSHD to switch to the current directory before running the command.

PUSHD %~dp0
req.vbs
POPD