|
-
Jun 21st, 2012, 12:19 AM
#1
Thread Starter
New Member
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
-
Jun 21st, 2012, 12:44 AM
#2
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
-
Jun 21st, 2012, 01:44 AM
#3
Re: Pass variables from .bat file to vbscript
Moved to the VBScript Forum.
-
Jun 21st, 2012, 04:39 AM
#4
Addicted Member
Re: Pass variables from .bat file to vbscript
 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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|