You can also start in a debugger.
windbg or ntsd (ntsd is a console program and maybe installed). Both are also from Debugging Tools For Windows.
Download and install Debugging Tools for Windows
http://msdn.microsoft.com/en-us/windows/hardware/hh852363
Install the Windows SDK but just choose the debugging tools.
Create a folder called Symbols in C:
Start Windbg. File menu - Symbol File Path and enter
srv*C:symbols*http://msdl.microsoft.com/download/symbols
then
windbg -o -g -G c:windowssystem32cmd.exe /k batfile.bat
You can press F12
to stop it and kb
will show the call stack (g
continues the program). If there's errors it will also stop and show them.
Type lm
to list loaded modules, x *!*
to list the symbols and bp symbolname
to set a breakpoint
Use db address
(as in db 01244
to see what's at that memory.
If programming in VB6 then this environmental variable link=/pdb:none
stores the symbols in the dll rather than seperate files. Make sure you compile the program with No Optimisations and tick the box for Create Symbolic Debug Info. Both on the Compile tab in the Project's Properties.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…