Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple commands in command prompt using vbscript

Tags:

vbscript

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.

like image 391
ayush kumar Avatar asked Feb 10 '15 16:02

ayush kumar


1 Answers

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
like image 106
Hackoo Avatar answered Oct 21 '22 17:10

Hackoo