Quantcast
Channel: Ebbes Nørderi (Ebbes Nerdery)
Viewing all articles
Browse latest Browse all 53

How to debug Windows Script Host, VBScript, and JScript files

$
0
0

To debug WSH scripts in Microsoft Visual InterDev, the Microsoft Script Debugger, or any other debugger, use the following command-line syntax to start the script:

wscript.exe //d <path to WSH file>
				

This code informs the user when a runtime error has occurred and gives the user a choice to debug the application. Also, the//x flag can be used, as follows, to throw an immediate exception, which starts the debugger immediately after the script starts running:

wscript.exe //d //x <path to WSH file>
See: http://support.microsoft.com/kb/308364

In order to debug .vbs file, you can specify "//D //X" options in script host. Both Windows-based script host (wscript.exe) and Command-based script host (cscript.exe) supports the same options. When //D //X options are specified, Visual Studio debugger will be launched and start debugging for the VB script. wscript displays output in Window form such as message box while cscript displays output into the console.

This command invokes VS debugger for test.vbs script file.

C:\Temp>wscript //D //X test.vbs

or

C:\Temp>cscript  //D //X test.vbs

[F10] key executes the VB script line by line.

See: http://debugbeyond.blogspot.dk/2010/10/how-to-debug-vbscript-vbs.html


Viewing all articles
Browse latest Browse all 53

Trending Articles