Pass variables from .bat file to vbscript
Hi all, need a help Passing variables from .bat file to vbscript. I have .bat file that launches test.vbs. I need to pass variable defined in the batch file inside the .vbs file.
the batch file contains the code
set /p var= please enter the value:
cscript test.vbs "%var%"
Where as test .vbs has the following codes
Dim StrText
MsgBox StrText
In my requirement value assigned to variable 'var' in batch should assign to StrText variable in the test.vbs and then it should display in VB message box.
Thanks..
Mithun
Re: Pass variables from .bat file to vbscript
I'm not sure about VBScript but in VB the command line parameters come in in the variable Command$
Try
Code:
Dim StrText
StrText=Command$
MsgBox StrText
Re: Pass variables from .bat file to vbscript
Moved to the VBScript Forum.
Re: Pass variables from .bat file to vbscript
Quote:
Originally Posted by
Mithunkurian
Hi all, need a help Passing variables from .bat file to vbscript.
Get command line arguments using WScript.Arguments within the .vbs file.