Search code examples
visual-studio-2013jscriptwsh

Debug WSH JScripts in Visual Studio Express


Is it possible to debug a JScript targeting Windows Scripting Host (WSH) in Visual Studio Express 2013?

Note: the code uses the GetObject method, which is not permitted in Internet Explorer anymore for security reason. So the IE debugger is not an option.

I see an explicit template for inserting WSH files (besides JScript files) in VS Express for Web, but I don't understand how to run them in VS debugger.

I tried to debug externally with administrator privileges:

cscript.exe  //x //d script.js
cscript.exe  //d script.js
cscript.exe  //x script.js
cscript.exe  //x //d script.wsh
cscript.exe  //d script.wsh
cscript.exe  //x script.wsh

To see if the problem is with my system Win7 x64, I installed the prehistoric Microsoft Script Debugger for NT and:

c:\windows\syswow64\cscript.exe  //x //d script.js
c:\windows\syswow64\cscript.exe  //x //d script.wsh

How can I go back to modern times?


Solution

  • You may not be able to do it with express but you can do it with the community edition. You need to do this to the registry

    [HKEY_CURRENT_USER\Software\Microsoft\Windows Script\Settings]
    "JITDebug"=dword:00000001
    

    You might want to add it to the tools/external tools in visual studio to make life easier. Starting with cscript //x //d will prompt for the debugger.