2

I'd like to find a free solution to debug vbscripts, and I tried Visual Studio 2019 Community Edition. I did the very basic installation with only one additional component, the Just-In-Time debugger. I ran all the following steps as administrator.

I have created the file Script2.vbs with this very simple script:

a=1
b=1/0
c=1

I started the command line (cmd.exe) and entered cscript.exe /x "C:\...\Script2.vbs cscript debug vbs

The script is executed and fails as expected at line 2 but

the problem is that the Just-In-Time debugger doesn't start.

(I expect the popup which is below "The Visual Studio Just-In-Time Debugger window appears" in this Microsoft article)

I have found in this question about the previous version of the Community Edition that there should be the option "Script", but I don't have it:

visual studio community options debugger jit script

Note also that if I try to start the script from Visual Studio Community, the menu Debug > Start debugging is grayed out:

visual studio community start debugging grayed out

My main question is:

Is the feature of debugging scripts turned off with Visual Studio Community Edition?

(which leads to the second question: is there a solution to debug VBS scripts for free?)

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • with my copy of VS 2019 Community this works as described - a new instance of VS 2019 is opened and i am able to step through the code, having run cscript /x somescript.vbs in CMD as Administrator – hello_earth Apr 13 '20 at 08:09
  • @hello_earth I guess that it works because `scd10en.exe` exists in your system, as Mark explained, the issue is that it's no more provided. – Sandra Rossi Apr 13 '20 at 12:13

4 Answers4

3

You can download the VBS debugger from my OneDrive https://1drv.ms/u/s!AvqkaKIXzvDieQeOGgxLJICZ-uY?e=3r5B91

It is called scd10en.exe.

It has disappeared from MS's web site.

  • Thank you. I'm sure `scd10en.exe` works because I had used it some time ago, but do you know a more official free solution? – Sandra Rossi Dec 02 '19 at 15:14
  • That's the only one I know off. –  Dec 02 '19 at 17:17
  • FWIW, the official download is archived in the wayback machine of the internet archive here: https://web.archive.org/web/20150302031023/http://www.microsoft.com/en-us/download/details.aspx?id=22185&6B49FDFB-8E5B-4B07-BC31-15695C5A2143=1 Direct link to the DL: https://web.archive.org/web/20140127135015/http://download.microsoft.com/download/7/7/d/77d8df05-6fbc-4718-a319-be14317a6811/scd10en.exe – founderio Jul 31 '20 at 22:49
2

If you are still interested, there is a way to fix Visual Studio Community. It's likely some missing pre-requisites. Therefore you need to "Modify" the installed options and find "Script" debugging options in the Individual Components setup.

For example this is my minimum set of components.

enter image description here

peregrinus
  • 56
  • 3
  • Thank you very much! I just checked now, "Just-In-Time debugger" was not selected and after I added it, this works and I will post a separated answer to detail all the steps. – Sandra Rossi Sep 20 '20 at 19:50
  • TGFSO - Thank God For Stack Overflow! Trying to debug a little vintage VBS script from back in 2009 on an older Server 2012 OS and your debug option become a bit limited. Classic scd10en.exe from 1997 still works, but it's a bit cumbersome. Visual Studio Community 2022 doesn't install properly on Server 2012 and will not work trying to attach Just-In-Time debugger. Visual Studio Community 2019 works perfectly when following the procedure described by peregrinus and @Sandra-Rossi Thanks for documenting this and saving the day! – BSmith Jan 30 '22 at 22:55
0

peregrinus gave the right answer so I Accepted it. Here are the details :

My test was with Visual Studio Community 2019, version 16.7.7.

  1. I installed Visual Studio from scratch with only the following 3 minimal components Minimal components for debugging VBS with Visual Studio Community 2019

    • Compilers, build tools, and runtimes
      • C++ CMake tools for Windows
      • MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.27)
    • Debugging and testing
      • Just-In-Time debugger
  2. I ran the VBS with the option /x to start the debugger
    CScript.exe /x Script2.vbs
    Cmd CScript.exe /x debug VBS

  3. A popup appears to select the Just-In-Time Debugger, I kept the options as proposed and pressed OK
    Visual Studio Community 2019 VBS JIT debugger after CScript /x

  4. The VBS code is shown, the debugger stops at the first line of the script
    Visual Studio Community 2019 VBS JIT debugger

  5. I can add a breakpoint at line 2, watch the variable a, and if I press Continue (F5), that stops at the breakpoint, etc.
    Visual Studio Community 2019 VBS JIT debugger, watch and breakpoint

NB: for information, I now see the third debugging option "Script" in VS menu Tools > Options: enter image description here

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
0

I installed Visual Studio 2019 Community Edition on a new installation of Windows 10 and experienced this same problem.

My initial installation of VS included just the ".NET desktop development" workload.

Once I installed the "Python Development" workload, the script option appeared under the Just-In-Time debugging options. No other changes were required.

Visual Studio Installer options

John
  • 159
  • 11