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:

  1. //B Batch mode: Suppresses script errors and prompts from displaying
  2. //D Enable Active Debugging
  3. //E:engine Use engine for executing script
  4. //H:CScript Changes the default scripting host to CScript.exe
  5. //H:WScript Changes the default scripting host to WScript.exe (default)
  6. //I Interactive mode (default, opposite of //B)
  7. //Job:xxxx Execute a WSC job
  8. //Logo Display logo (default)
  9. //Nologo Prevent logo display: No banner will be shown at execution time
  10. //S Save current command line options for this user
  11. //T:nn Time out in seconds: Maximum time a script is permitted to run
  12. //X Execute script in debugger when Active Debugging enabled

Yes you need to type '/' twice.

Suppose you had the following hello.vbs file:

  1. Wscript.Echo "Hello"
  2. Wscript.Quit 0

You would run with command

  1. C:\> cscipt hello.vbs

which would print Hello to the command window. Typing

  1. C:\> wscript hello.vbs

would bring up Hello in a window.


See also, "Windows Scripting Resources" and "Windows Scripting Tips."