Solved Passing variable from vbscript to batch file using arguments

April 1, 2013 at 15:53:34
Specs: Windows 7
Please how to pass the variable named 'myVar' from this piece of vbs to my batch named job.bat? Indeed when doing echoing (echo %2) from job.bat, i notice that the myVar is not passed properly. Prompt command views myVar instead of the value retrieved from vbs. Thanks

For Each listElement In xmlDoc.selectNodes("document/Lists/list")
msgbox "toto"
myVar=listElement.selectSingleNode("entry").text
out= listElement.selectSingleNode("output").text
jeton= listElement.selectSingleNode("token").text

dim shell
set shell=createobject("wscript.shell")
shell.run "job.bat ""a file"" myVar "
set shell=nothing
Next


See More: Passing variable from vbscript to batch file using arguments

Report •

#1
April 2, 2013 at 06:37:51
✔ Best Answer
Variables go outside of the strings.
shell.run "job.bat ""a file"" " & myVar

How To Ask Questions The Smart Way


Report •
Related Solutions


Ask Question