Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use WshShell.Run to run windbg with a variable?

Status
Not open for further replies.

cbsarge

IS-IT--Management
Jun 20, 2001
219
US
I'm trying to write a little vbs script that will bring up a browse for file dialog that defaults to the minidump folder where I can select a .dmp file and then launch windbg opening the file. So far I have the following code but, it doesn't work. I get the browse for file and select a .dmp file but, windbg never launches.

Thanks for any help!

Code:
Set objDialog = CreateObject("UserAccounts.CommonDialog")
objDialog.Filter = "All Folders|*.dmp"
objDialog.InitialDir = "C:\Windows\Minidump"
intResult = objDialog.ShowOpen
If intResult = 0 Then
    Wscript.Quit
Else
    set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.Run ("cmd /c c:\program files\debugging tools\windbg -y srv*c:\symbols*[URL unfurl="true"]http://msdl.microsoft.com/download/symbols[/URL] -i c:\windows\i386 -z c:\windows\minidump")& intResult,0,True
End If

[!]The AutoSavers![/!] [2thumbsup]
 
Hmmm... No combination of double quotes seems to make a difference. I tried the following combinations:

your suggestion
Code:
WshShell.Run ("cmd /c""c:\program files\debugging tools\windbg"" -y srv*c:\symbols*[URL unfurl="true"]http://msdl.microsoft.com/download/symbols[/URL] -i c:\windows\i386 -z c:\windows\minidump")& intResult,0,True
as well as
[code]
WshShell.Run ("cmd /c""c:\program files\debugging tools\windbg -y srv*c:\symbols*[URL unfurl="true"]http://msdl.microsoft.com/download/symbols[/URL] -i c:\windows\i386 -z c:\windows\minidump""")& intResult,0,True
but neither launches windbg - the script just ends.

[!]The AutoSavers![/!] [2thumbsup]
 
Code:
WshShell.Run """c:\program files\debugging tools\windbg"" -y srv*c:\symbols*[URL unfurl="true"]http://msdl.microsoft.com/download/symbols[/URL] -i c:\windows\i386 -z c:\windows\minidump" & intResult, 1, True

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Still no luck. Perhaps this can't be launched this way? I've even tried removing the variable from the end of the string and using an existing .dmp file in the last part of the path and it still wont launch.

Code:
WshShell.Run """c:\program files\debugging tools\windbg"" -y srv*c:\symbols*[URL unfurl="true"]http://msdl.microsoft.com/download/symbols[/URL] -i c:\windows\i386 -z c:\windows\minidump\dumpfile.dmp", 1, True

[!]The AutoSavers![/!] [2thumbsup]
 
And this ?
Code:
WshShell.Run "start /wait ""c:\program files\debugging tools\windbg"" -y srv*c:\symbols*[URL unfurl="true"]http://msdl.microsoft.com/download/symbols[/URL] -i c:\windows\i386 -z c:\windows\minidump\dumpfile.dmp", 1, True

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Argh

Script: c:\documents and settings\username\desktop\script.vbs
Line: 9
Char: 1
error: The system cannot find the file specified
code: 80070002
source: (null)

[!]The AutoSavers![/!] [2thumbsup]
 
It appears that you may have a syntax problem. Have you ever been able to run this command at a standard command prompt?

If yes, please post the functional command. That will give us a good reference point to troubleshoot the script.


PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
Here is the version I got working. It looks like the space in the path to windbg was enough to make it not work in the first few itterations. I moved the debugging tools to c:\debuggingtools and it got past that problem. I also took out the c:\windows\minidump\ that prefaced the actual dmp file because it's captured by the intResult variable.
Code:
Set objDialog = CreateObject("UserAccounts.CommonDialog")
objDialog.Filter = "All Folders|*.dmp"
objDialog.InitialDir = "C:\Windows\Minidump"
intResult = objDialog.ShowOpen
If intResult = 0 Then
	Wscript.Echo "You failed to select a DMP file."
    Wscript.Quit
Else
    set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.Run ("cmd /c c:\debuggingtools\windbg -y srv*c:\symbols*[URL unfurl="true"]http://msdl.microsoft.com/download/symbols[/URL] -i c:\windows\i386 -z ")& objDialog.FileName
End If

Thanks to everyone that helped!

[!]The AutoSavers![/!] [2thumbsup]
 
One last nit for anyone who decides to use this script. I added "0,True" to the end of the WshShell.Run statement so the cmd window doesn't stay visible.
Code:
Set objDialog = CreateObject("UserAccounts.CommonDialog")
objDialog.Filter = "All Folders|*.dmp"
objDialog.InitialDir = "C:\Windows\Minidump"
intResult = objDialog.ShowOpen
If intResult = 0 Then
	Wscript.Echo "You failed to select a DMP file."
    Wscript.Quit
Else
    set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.Run ("cmd /c c:\debuggingtools\windbg -y srv*c:\symbols*[URL unfurl="true"]http://msdl.microsoft.com/download/symbols[/URL] -i c:\windows\i386 -z ")& objDialog.FileName,0,True
End If

[!]The AutoSavers![/!] [2thumbsup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top