Cscript command in Windows

The cscript command starts a script to run in the command line environment.
  1. Applies to : Windows Server (Semi-Annual Channel), Windows Server 2016, Windows Server 2012 R2, Windows Server 2012.

The cscript command starts a script to run in the command line environment.

Syntax cscript command

 cscript [/B] [/D] [/E:] [{/H:cscript|/H:wscript}] [/I] [/Job:] [{/Logo|/NoLogo}] [/S] [/T:] [/X] [/U] [/?] [] 

Parameters

ParameterDescriptionScriptname.extension Specifies the path and name of the script file with the optional extension. / B Specify the batch mode, this mode does not display warnings, script errors, or import prompts. / D Start the debugger. / E: Specify the tool used to run the script. / H: cscript Register cscript.exe as the default server to run the script. / H: wscript Register wscript.exe as the default server to run the script. This is the default option. / I Specifies the interactive mode, alert display, script error and prompt to enter. This is the default option and vice versa . / Job: Run the task identified by Identifier in the .wsf script file. / Logo Specifies that the Windows Script Host banner is displayed in the control panel before the script runs. This is the default option and vice versa . / Nologo Specifies that the Windows Script Host banner is not displayed before the script runs. / S Save command prompt options for the current user. / T: Specify the maximum time that the script can run (in seconds). You can specify up to 32,767 seconds. The default is not limited to time. / U Specifies Unicode for input and output to be redirected from the console. / X Start the script in the debugger. /? Show available command parameters and provide help to use them. This is like typing cscript.exe without parameters and no script. ScriptArguments Specifies the arguments passed to the script. Each script argument must have a slash ( / ).

Note when using cscript command

  1. Performing this task does not require you to have administrative login information. Therefore, for best security, consider executing this task as a user without administrative login information.
  2. To open a Command Prompt, on the Start screen , enter cmd, then click the command prompt .
  3. Each parameter is not required. However, you cannot specify script arguments without assigning scripts. If you do not specify a script or any script argument, cscript.exe displays the syntax of cscript.exe and valid server options.
  4. The / T parameter prevents running too many scripts by setting a timer. When the runtime exceeds the specified value, the cscript command interrupts the script tool and terminates the process.
  5. Windows script files often have one of the following file name extensions: .wsf, .vbs, .js.
  6. You can set properties for each script.
  7. The Windows Script Host can use .wsf script files. Each .wsf file can use many scripting tools and perform many tasks.
  8. If you double-click the script file whose extension has no link, the Open With dialog box will appear. Choose wscript or cscript, then select Always use this program to open this type file . This registers wscript.exe or cscript as the server that stores the default script for files of this type.

See more:

  1. Compact command in Windows
  2. The convert in Windows command
  3. Comp command in Windows
4.3 ★ | 4 Vote