CScript.exe / wscript.exe

Run a VBScript / Windows Scripting Host (WSH) script.

'cscript' runs entirely in the command line and is ideal for non-interactive scripts.
'wscript' will popup Windows dialogue boxes for user interaction.

       cscript [options...] [ScriptName.vbs] [script_arguments]

       wscript [options...] [ScriptName.vbs] [script_arguments]


   ScriptName.vbs  : Text file containing VBS commands to be execute.
                     You must include the extension (normally .vbs)

   //T:nn      Timeout script after nn seconds

   //nologo    hide startup logo
   //Logo      or Display logo (default)

   //I         Interactive mode
   //B         or Batch mode

   //E:engine  Use engine for executing script e.g. //E:jscript

   //H:CScript Change the default vbs script host to CScript.exe
   //H:WScript Change the default vbs script host to WScript.exe (default)

   //Job:xxxx  Execute a WSF job

   //S         Save current command line options for this user

   //D         Enable Active Debugging
   //X         Execute script in debugger
   //U         Use Unicode for redirected I/O from the console


Run the VB script called myscript.vbs:

C:\> cscript myscript.vbs

If the line above is saved as a batch script, double clicking the batch file will run the VBScript file.

Call one VB script from another. This can be done as shown below, although it is usually better to put everything in a single script and use Functions to split up the blocks of code.

Set objShell = CreateObject("WScript.Shell")"cscript C:\scripts\demo.vbs")

The VB Script scripting environment is installed by default on Windows 98 and all later versions of Windows.

“Throw a lucky man in the sea, and he will come up with a fish in his mouth” ~ Arab proverb


.Exec - execute command
.Run - Run an external Command.
.ShellExecute - Run an application in the Windows Shell

Quit - Quit vbs script

Copyright © 1999-2017
Some rights reserved