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.