Multiple commands in command prompt using vbscript

后端 未结 1 1662
暗喜
暗喜 2021-02-06 12:20
Set oShell = CreateObject(\"WScript.Shell\")
oShell.Run \"cmd /c c:\"

This line executes perfectly fine. Now I need to enter a text.

For exampl

1条回答
  •  误落风尘
    2021-02-06 12:58

    You must add & after each command and change cmd /c to cmd /k

    1. The first command is : CD /D c:\
    2. The second command is : Dir
    3. The third command is : ping 127.0.0.1

    Try like this :

    Set oShell = CreateObject("WScript.Shell")
    Command = "cmd /K cd /d c:\ & Dir & ping 127.0.0.1"
    oShell.Run Command,1,True
    

    0 讨论(0)
提交回复
热议问题