Windows Script Host
Run Method (Windows Script Host)
Runs a program in a new process.
object.Run(strCommand, [intWindowStyle], [bWaitOnReturn])
The following VBScript code opens a copy of the currently running script with Notepad.
Code: Select all
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "%windir%\notepad " & WScript.ScriptFullName
The following VBScript code does the same thing, except it specifies the window type, waits for Notepad to be shut down by the user, and saves the error code returned from Notepad when it is shut down.
Code: Select all
Set WshShell = WScript.CreateObject("WScript.Shell")
Return = WshShell.Run("notepad " & WScript.ScriptFullName, 1, true)
The following VBScript code opens a command window, changes to the path to C:\ , and executes the DIR command.
Code: Select all
Dim oShell
Set oShell = WScript.CreateObject ("WSCript.shell")
oShell.run "cmd /K CD C:\ & Dir"
Set oShell = Nothing
Windows Script Host
Exec Method (Windows Script Host)
Runs an application in a child command-shell, providing access to the StdIn/StdOut/StdErr streams.
object.Exec(strCommand)
The following example demonstrates the basics of the Exec method.
Code: Select all
Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec("calc")
Do While oExec.Status = 0
WScript.Sleep 100
Loop
WScript.Echo oExec.Status
Learning vbScript/jScript is difficult without the proper tools to aid you in your quest.
try this free program
http://www.vbsEdit.COM