Click here to Skip to main content
15,881,803 members
Articles / Programming Languages / VBScript

How to Debug Visual Basic Script with Visual Studio

Rate me:
Please Sign up or sign in to vote.
4.52/5 (15 votes)
29 Nov 2019CPOL1 min read 139.6K   22   23
This tip shows how easy it is to debug the VBScript by using Visual Studio Debugger


If you are programming with Visual Basic Script, you have difficulties to find a bug in your script: there isn't any debugger for VBS! This tip shows how you can easily use Visual Studio for this.


Normally, you start a script from the command line like this:


cscript.exe myScript.vbs

In order to debug your script you only need to add the parameter /x:


cscript.exe /x myScript.vbs

This will set a breakpoint and throw an immediate exception, which starts the debugger immediately after the script starts running.

The following dialog will be shown where you can choose Visual Studio and step into your VBS code:

Not all versions of Visual Studio support Just-In-Time debugging, especially the VS Express Editions are the problem. You recognize whether your version supports the JIT debugging as follows:


Visual Studio -> Tools -> Options -> Debugging -> Just-In-Time

A good news: the new Visual Studio 2019 (even the Community Edition) do support the VBS debugging!

Another possibility is to bind the VBS debugger as an external tool: Tools -> External Tool:

External Tool

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":

Start debugging

Useful Links and Information

  1. Creating And Using Scripts -
  2. How To Debug WSH, VBScript And JScript


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
Software Developer
Germany Germany

I'm a software developer living in Germany with my family (wife & 2 sons).
My hobbies: sport, traveling, books (former reading, now hearing).
Welcome to my homepage:

Comments and Discussions

GeneralMy vote of 5 Pin
Gustav Brock3-Dec-19 1:22
professionalGustav Brock3-Dec-19 1:22 
GeneralRe: My vote of 5 Pin
Leo Chapiro3-Dec-19 23:42
professionalLeo Chapiro3-Dec-19 23:42 
QuestionVery helpful, thank you! Pin
SmokeHead29-Nov-19 9:49
SmokeHead29-Nov-19 9:49 
AnswerRe: Very helpful, thank you! Pin
Leo Chapiro29-Nov-19 9:51
professionalLeo Chapiro29-Nov-19 9:51 
QuestionPossible typo Pin
Member 460889821-Jan-17 21:13
Member 460889821-Jan-17 21:13 
AnswerRe: Possible typo Pin
Leo Chapiro23-Jan-17 5:13
professionalLeo Chapiro23-Jan-17 5:13 
GeneralMy vote of 1 Pin
Abhishek Kumar Goswami17-Sep-15 5:43
professionalAbhishek Kumar Goswami17-Sep-15 5:43 
GeneralRe: My vote of 1 Pin
Leo Chapiro17-Sep-15 19:39
professionalLeo Chapiro17-Sep-15 19:39 
GeneralRe: My vote of 1 Pin
SmokeHead17-Sep-15 22:03
SmokeHead17-Sep-15 22:03 
Questionproposals to update your useful article Pin
Emmet M13-Jan-15 7:03
Emmet M13-Jan-15 7:03 
AnswerRe: proposals to update your useful article Pin
Leo Chapiro13-Jan-15 7:41
professionalLeo Chapiro13-Jan-15 7:41 
AnswerRe: proposals to update your useful article Pin
Member 334412913-Jan-15 13:06
Member 334412913-Jan-15 13:06 
GeneralRe: proposals to update your useful article Pin
Leo Chapiro13-Jan-15 18:48
professionalLeo Chapiro13-Jan-15 18:48 
Questionuseful tip Pin
Member 334412913-Jan-15 3:33
Member 334412913-Jan-15 3:33 
AnswerRe: useful tip Pin
Nelek13-Jan-15 4:12
protectorNelek13-Jan-15 4:12 
GeneralMessage Closed Pin
13-Jan-15 7:42
professionalLeo Chapiro13-Jan-15 7:42 
GeneralRe: useful tip Pin
Nelek13-Jan-15 10:31
protectorNelek13-Jan-15 10:31 
GeneralRe: useful tip Pin
Member 334412913-Jan-15 13:04
Member 334412913-Jan-15 13:04 
GeneralRe: useful tip Pin
Nelek13-Jan-15 14:09
protectorNelek13-Jan-15 14:09 
GeneralRe: useful tip Pin
Member 334412914-Jan-15 6:43
Member 334412914-Jan-15 6:43 
AnswerNot a tip Pin
Akhil Mittal13-Jan-15 1:11
professionalAkhil Mittal13-Jan-15 1:11 
GeneralRe: Not a tip Pin
Leo Chapiro13-Jan-15 1:51
professionalLeo Chapiro13-Jan-15 1:51 
GeneralRe: Not a tip Pin
Abhishek Kumar Goswami17-Sep-15 19:58
professionalAbhishek Kumar Goswami17-Sep-15 19:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.