• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 696
  • Last Modified:

How to launch debug mode for a javascript using WScript.exe

Greetings,

I have been using the following command to debug a js routine:

C:\test\>//X MyProgram.js test.txt

I since found that on a 64 bit machine I need to use SysWOW64 to compensate:

"C:\Windows\SysWOW64\WScript.exe" "C:\test\MyProgram.js" "C:\test\test.txt"

Is it possible to still launch the debugger with this?  What is the syntax?

Thanks
0
John500
Asked:
John500
  • 4
  • 3
1 Solution
 
leakim971PluritechnicianCommented:
0
 
John500Author Commented:
Thanks for the input here.

I tried the following debug switch:

"C:\Windows\SysWOW64\WScript.exe //D" "C:\test\MyProgram.js" "C:\test\test.txt"

However, this did not launche the debugger.

What do you suggest ?

Thanks

0
 
hieloCommented:
When you have a string sorrounded in double quotes, to represent ONE backslash \, you need to use TWO \\

"C:\\Windows\\SysWOW64\\WScript.exe //D" "C:\\test\\MyProgram.js" "C:\\test\\test.txt"
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
John500Author Commented:
>>  you need to use TWO \\

I'm not sure I agree.  As it stands now, I have no problem launching the javascript file from a batch file using this syntax:


"C:\Windows\SysWOW64\WScript.exe" "C:\test\MyProgram.js" "C:\test\test.txt"

Since this syntax works, the begging question is, what syntax do I need to launch the debugger?  If I add the  //D like this:

"C:\Windows\SysWOW64\WScript.exe //D" "C:\test\MyProgram.js" "C:\test\test.txt"

... the script doesn't run at all.

0
 
hieloCommented:
>>I'm not sure I agree...
My apologies for that. I misunderstood your question. I thought you were executing dynamically via a shell object from within your script - ex:

var shell = WScript.CreateObject("WScript.Shell");
...

but not it's clear you are executing from the command line.  Try placing it OUTSIDE the quote:

C:\test\> "C:\Windows\SysWOW64\WScript.exe" //D "C:\test\MyProgram.js" "C:\test\test.txt"
0
 
John500Author Commented:
hielo,

Appreciate the feedback... I've been slow moving on this.

I made the change you suggested and it was successfull from the standpoint that the process was launched and ran as it should.  However, the Visual Studio debugger was never launched.

Any other guesses?

Thanks
0
 
hieloCommented:
did you try the //X instead of //D?

C:\test\> "C:\Windows\SysWOW64\WScript.exe" //X "C:\test\MyProgram.js" "C:\test\test.txt"
0
 
John500Author Commented:
That was the ticket.  Thanks!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now