Donny73Ger
Donny73Ger

Reputation: 31

From VBS to BAT and back: Taking user inputs from the command line to VBS

is there a way to start a *.bat from a *.vbs, then get the users command line input into a *.bat variable and give it back to vbscript code?

Thanks in advance.

Kind regards.

Tommy

Upvotes: 0

Views: 632

Answers (1)

user6017774
user6017774

Reputation:

Set Arg = WScript.Arguments
set WshShell = createObject("Wscript.Shell")
Set Inp = WScript.Stdin
Set Outp = Wscript.Stdout
Sub ShowMenu
    Do
        ShowHelpMenu
        Answ=Inp.readline
        If Answ = "1" Then
            ShowGeneralHelp "TEXT"
        Elseif Answ = "2" Then
            ShowGeneralHelp "HTML"
        Elseif Answ = "3" Then
            Version
        Elseif Answ = "4" Then
            History
        Elseif Answ = "5" Then
            Exit Do
        End If
    Loop
End Sub

To run

cscript //nologo 'c:\somefile.vbs"

Upvotes: 1

Related Questions