Home > DeveloperSection > Forums > How can a batch file receive two values from a VB Script?
Ankita Pandey
Ankita Pandey

Total Post:183

Points:1285
Posted on    June-20-2013 1:43 AM

 VB Script VB Script 
Ratings:


 1 Reply(s)
 1955  View(s)
Rate this:
Hi Expert,

The VB script takes one parameter as input. Is it possible to enter two parameters? Also could I use drop down list as well in the below script?

@echo off

> usermessage.vbs ECHO WScript.Echo InputBox( "Enter parameter1", "para1", "xxxxxxxx" )
FOR /F "tokens=*" %%A IN ('CSCRIPT.EXE //NoLogo usermessage.vbs') DO SET para1=%%A

ECHO para1= %para1%

DEL usermessage.vbs

Thanks in advance for any recommendations or solutions.


Vijay Shukla

Total Post:100

Points:700
Posted on    June-20-2013 5:18 AM

Hi Expert,

try as following

@echo off
setlocal EnableDelayedExpansion

usermessage.vbs ECHO WScript.Echo InputBox( "Enter parameter1", "para1", "xxxxxxxx" )
usermessage.vbs ECHO WScript.Echo InputBox( "Enter parameter2", "para2", "yyyyyyyy" )
usermessage.vbs ECHO WScript.Echo InputBox( "Enter parameter3", "para3", "zzzzzzzz" )

set i=0
FOR /F "tokens=*" %%A IN ('CSCRIPT.EXE //NoLogo usermessage.vbs') DO (
   set /A i+=1
   SET para!i!=%%A
)

ECHO para1= %para1%
ECHO para2= %para2%
ECHO para3= %para3%

DEL usermessage.vbs


Don't want to miss updates? Please click the below button!

Follow MindStick