1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | '========================================================================== ' ' NAME: runcommand.vbs ' ' AUTHOR: John Sorensen ' ' COMMENT: ' '========================================================================== strCommand = "ipconfig" 'This is where you place command WScript.Echo "Running command: " & strCommand WScript.Echo set objShell = CreateObject("Wscript.Shell") set objProc = objShell.Exec(strCommand) Do WScript.Sleep 100 Loop Until objProc.Status <> 0 if objProc.ExitCode <> 0 Then WScript.Echo "EXIT CODE: " & objProc.ExitCode WScript.Echo "ERROR: " & objProc.StdErr.ReadAll end if WScript.Echo "OUTPUT: " & objProc.StdOut.ReadAll |
Run a command via vbscript
Posted by John Sorensen on June 29th, 2009
Further Reading
- None Found


Posted in
Tags: