This is a useful script to call another script within VBScript. Using the Run method within the WshShell object allows you to call any script within a VBScript. The Run method takes three parameters, script name, window style (how the application will open), and whether or not to wait for the script to end before continuing. The script below calls a script, hides the script on open, and waits for the script to complete before continuing. Uses a simple return value to test for success/fail.
Dim ReturnValue Dim objShell: Set objShell = CreateObject("WScript.Shell") ReturnValue = objShell.Run("C:\Script.exe /p=passvariables",0,true) WScript.Echo "ReturnValue: " & ReturnValue If (ReturnValue 0) Then WScript.Echo "Failed with error: " & ReturnValue Else WScript.Echo "Success with return value: " & ReturnValue End If
Reference: http://msdn.microsoft.com/en-us/library/d5fk67ky%28v=VS.85%29.aspx
The Run method can be used for so much more. For example, you can open Notepad, type some characters, save the changes, and close Notepad. Uses for this method are endless.
For example:
Reference: http://technet.microsoft.com/en-us/library/ee156592.aspx