Has anyone gotten a debugger attached to mshta.exe after installing IE9? (64bit or WOW64)
问题:
回答1:
I'm on a Vista x64, so I have to contend with the 32bit/64bit barrier.
HTA
- c:\windows\system32\mshta.exe (mshta32)
- c:\windows\syswow64\mshta.exe (mshta64)
Launching
- "mshta32 foo.hta" may use mshta32 or mshta64 depending on what is associated with HTA
- the same goes if "mshta64 foo.hta" is used
- "cmd /C start foo.hta" would have the same affect.
Debugger
- MS Script Editor (from Office XP/2003) for JS debugging in IE/HTA
Normally I would use the debugger
keyword to initiate the launching of the debugger, however with IE9, it doesn't seem to do that anymore. I must launch the debugger first, attach to the mshta.exe process manually (only supports 32bit). Then everything appears to work fine!
EDIT:
With coworkers, different machine have exhibited different behaviors:
debugger
keyword works fine- Connecting to
MSHTA.EXE
from the debugger doesn't work
I haven't yet found a silver bullet.
回答2:
If you have Visual Studio, go to Tools -> Attach to Process
and attach to the MSHTA.EXE
process. Then pick Script
as the target to debug.
回答3:
Try using 'Stop' statement. This should raise the debugger dialog
回答4:
I had the same problem. Finally pieced together how to debug using Visual Studio from two sources
- Turn on script debugging through Internet Explorer, as described here and here
- Start up Visual Studio. Click on Debug -> Attach to Process
- Run the .hta file and select the running process from the Attach to Process dialog