[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More


Difference between cscript and wscript

Published on
7,572 Points
Last Modified:
Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines.

The key components of Windows Script Host are CSCript, WScript, WSH ActiveX Control and Scripting engines.

WSH ActiveX Control:
An ActiveX control that provides the core object model for the scripting host. Scripting Engines

Scripting engines
Scripting engines provide the core functions, objects, and methods for a particular scripting language. VBScript and JScript scripting  engines are installed by default on Windows.

CSCript and WScript are executables for the scripting host that are used to run the scripts. CSCript and WScript are both interpreters to run VBScript (and other scripting languages like JScript) on the Windows platform.

CSScript is for console applications and WScript is for Windows applications. The Kernel checks a flag in the executable to determine which 

When starting using CreateProcess, if it is a console application, the kernel will create a console window for it if the parent process doesn't have one, and attach the STDIN and STDOUT and STDERR to the console. If it is a Windows application, no console will be created and STDIN, STDOUT and STDERR will be closed by default.

If you want your script to have a console window, use CSCRIPT.EXE. If you want it to NOT have a console window, use WSCRIPT.EXE.

This also affects some behaviors, such as the WScript.Echo command. In a CSCRIPT.EXE this writes a line to the console window. In WSCRIPT.EXE it shows a messagebox.

When using CScript.exe:1.jpg
When we execute the above VBScript with CScript.exe, it displays hi (called through WScript.echo) in command prompt.

When using WScript.exe:

When we execute the above VBScript with WScript.exe, it displays hi (called through WScript.echo) in MessageBox. MsgBox will display a message box in both cases.

The WScript word in WScript.echo is not related to WScript.exe.
WScript.exe -> a command line executable for WSH.
WSCript        -> an object in Core Object Model provided in WSH.
Usage of CSCript.exe:
The command line options for CSCript.exe are in this screenshot.
3.jpg[ ] refers to optional data, i.e., not mandatory. 

Usage of WSCript.exe:
The command line options for WSCript.exe in this screenshot.
Again, [ ] refers to optional data, i.e., not mandatory. 

Featured Post

Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

Join & Write a Comment

The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month