Multiple commands in command prompt using vbscript
14,992
You must add & after each command and change cmd /c to cmd /k
- The first command is : CD /D c:\
- The second command is : Dir
- 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
Author by
Admin
Updated on June 26, 2022Comments
-
Admin over 1 year
Set oShell = CreateObject("WScript.Shell") oShell.Run "cmd /c c:"
This line executes perfectly fine. Now I need to enter a text.
For example:
c:\users> "abcd"
How do I go about it in the already opened cmd prompt.