How to Debug a VBS Script


Debugging provides developers with the tools to identify logic and syntax errors. The debugger allows you to step through each line of code, view variable values and identify where your code is faulty. The Microsoft operating system provides a debugger for use with VBScript files. VBScript files are plain text documents used to execute code. They are Visual Basic files that are typically used for logon scripts on network user machines.

  • Click the Windows Start button and select "Run." Enter "cmd" into the text box and press the "Ok" button. This opens the Windows command prompt.

  • Enter the following statement into the command prompt:
    wscript.exe //d <script file location>
    Replace "<script file location>" with the complete path to your VBScript file. This command opens and executes the script in the debugger, so you can step through each statement.

  • Press the F10 key to step through the file. The current line of code is highlighted in yellow. After you press the F10 button, the cursor moves to the next line. View the "Watch List" at the bottom of your screen to view the values of your variables. If a syntax error occurs, the debugger displays the error and stops processing until you fix the code.

  • Press the "Stop" button to quit the debug process. Your debugger is closed, and your script file is left intact.

Related Searches


  • Photo Credit network cables image by glinn from
Promoted By Zergnet


Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

Is DIY in your DNA? Become part of our maker community.
Submit Your Work!