从VBS到BAT并返回:将用户输入从命令行转移到VBS

时间:2016-04-13 09:41:03

标签: variables batch-file command-line vbscript cmd

有没有办法从* .vbs启动* .bat,然后将用户命令行输入到* .bat变量并将其返回给vbscript代码?

提前致谢。

亲切的问候。

托米

1 个答案:

答案 0 :(得分:1)

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

运行

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