VBScript – How to pass a variable from VBS to a Batch file

--> (Word) --> (PDF) --> (Epub) --> (Text)
--> (XML) --> (OpenOffice) --> (XPS)

SCENARIO

I’m using vbscript to call a [gs batch] file. My [gs script] looks like:

dim shell
set shell=createobject("wscript.shell")
shell.run "a.bat"
set shell=nothing

My batch file is simple and looks like:

D:
cd D:\d
winzip32.exe -min -a D:\a

I want to pass a variable from a script to the batch file. lets say the destination [gs folder]. How do i do that?

Any help is very much appreciated.

SOLUTION

I think that you can just pass variables to the batch file. You can call it like:

shell.run "a.bat var1 var2"

And in your [gs batch] file, you can refer to them as:

%1 for "var1"
%2 for "var2"

And you can do this from %1 to %9.

SOURCE

LINK (Stackoverflow.com)

LANGUAGE
ENGLISH