web analytics

How to debug VBScript code using cscript.exe?

Options

codeling 1599 - 6654
@2016-01-05 10:44:52

With Cscript.exe, you can run scripts by typing the name of a script file at the command prompt. Windows Script Host serves as a controller of Windows Script compliant scripting engines, but Windows Script Host has very low memory requirements. Windows Script Host is ideal for both interactive and non-interactive scripting needs, such as logon scripting and administrative scripting.

Windows Script Host supports scripts written in VBScript or JScript. When you start a script from your desktop or from the command prompt, the script host reads and passes the specified script file contents to the registered script engine. The script engine uses file extensions (that is, .vbs for VBScript and .js for JScript) to identify the script.

To debug your VBscript code, you may use the /X option:

cscript /X c:\abc.vbs

Then you have to choose which debugger you want to use in the following popup windows:

 

@2016-01-05 11:03:43

Batch Mode

Another option you might want to take a look at is //B, the batch mode option:

cscript test.vbs //B

When you specify this option, no output will display to the screen, not even the logo information. The same is true if you use the //B option with Wscript: no message boxes will be displayed. One case in which this can be useful is if you’re running logon scripts and you don’t want anything to display to the user.

One thing to watch out for when using this option is that not only does it hide the output from your script, but it hides error information too.

Comments

You must Sign In to comment on this topic.


© 2024 Digcode.com