How do I run a windows script from the command line?
Learn how to run a Windows script from the command line. To run from the command line, use CSCRIPT.EXE which has a number of optionalparameters as follows:
John Savill
May 25, 1999
1 Min Read
A. Normally, when you run a Windows Scripting Host file such as a Visual Basic or Java script, Explorer WSCRIPT.EXE is executed and runs the script using the necessary script plug-in.
To run from the command line, use CSCRIPT.EXE which has a number of optional parameters as follows:
//B Batch mode: Suppresses script errors and prompts from displaying//D Enable Active Debugging//E:engine Use engine for executing script//H:CScript Changes the default scripting host to CScript.exe//H:WScript Changes the default scripting host to WScript.exe (default)//I Interactive mode (default, opposite of //B)//Job:xxxx Execute a WSC job//Logo Display logo (default)//Nologo Prevent logo display: No banner will be shown at execution time//S Save current command line options for this user//T:nn Time out in seconds: Maximum time a script is permitted to run//X Execute script in debugger when Active Debugging enabled
Yes you need to type '/' twice.
Suppose you had the following hello.vbs file:
Wscript.Echo "Hello"Wscript.Quit 0
You would run with command
C:> cscipt hello.vbs
which would print Hello to the command window. Typing
C:> wscript hello.vbs
would bring up Hello in a window.
See also, "Windows Scripting Resources" and "Windows Scripting Tips."
About the Author
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
You May Also Like