HOW CAN A BATCH FILE RECEIVE TWO VALUES FROM A VB SCRIPT?

Ankita Pandey

Total Post:183

Points:1285
Posted by  Ankita Pandey
 2195  View(s)
Ratings:
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.
  1. Vijay Shukla

    Post:100

    Points:700
    Re: How can a batch file receive two values from a VB Script?

    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

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!