Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I debug a stand-alone VBScript script?

I have a VBScript script that takes 2 command-line arguments and does some validation. I need to debug this to see how the program is getting executed. I was trying to paste this into Excel (using VBA). However there are some constructs like Const, etc. that are not being supported, plus certain validations like taking the command-line arguments are failing.

Hence I would like to know if there is any way to debug this script. I have Windows XP and Office 2003 installed. I cannot install any other applications on the office computer.

like image 205
Dheer Avatar asked Feb 18 '10 11:02

Dheer


People also ask

How do I debug a VBScript in Visual Studio?

First of all VBScript is an interpreted language and does not need to be compiled. Then, just open the file you want to debug with Visual Studio (via File --> Open --> File...) In order to start the debugger, just click "Tools / VBScript Debug". The VS JIT debugger asks you, which debugger you want to use.

How do I run a VBS script manually?

Click the Start button, and then click Run. In the Open field, type the full path of the script, and then click OK. You can also type WScript followed by the full name and path of the script you want to run.


2 Answers

Run cscript.exe for full command args, I think

cscript //X scriptfile.vbs MyArg1 MyArg2 

will run the script in a debugger.

like image 193
Binary Worrier Avatar answered Oct 06 '22 05:10

Binary Worrier


This is for future readers. I found that the simplest method for me was to use Visual Studio -> Tools -> External Tools. More details in this answer.

Easier to use and good debugging tools.

like image 21
shash Avatar answered Oct 06 '22 03:10

shash