Sending result of WinDbg command to text file?

Hello all,

is there a way to send a command to a text file? I know that $<
redirects the file into the command line, is there a way to redirect
the command output into a file?

My reason for doing this is that I would like to record my current
.bpcmds so that I can later reload them.

Thanks,
J

.logopen and .logclose.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Jonathon
Sent: Tuesday, January 25, 2011 04:39 PM
To: Kernel Debugging Interest List
Subject: [windbg] Sending result of WinDbg command to text file?

Hello all,

is there a way to send a command to a text file? I know that $< redirects the file into the command line, is there a way to redirect the command output into a file?

My reason for doing this is that I would like to record my current .bpcmds so that I can later reload them.

Thanks,
J


WINDBG is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

i normally have a file in windbg folder that has these contents

F:\windbg\612windbg>type dumpbps
.logopen “${$arg1}”
bl
.bpcmds
.logclose
F:\windbg\612windbg>

and use it like this

0:000> $$>a< dumpbps “c:\documents and settings\admin\desktop\nebp.txt”
Opened log file ‘c:\documents and settings\admin\desktop\nebp.txt’
0 e 00401150 0001 (0001) 0:**** windb!main
1 e 7c90120e 0001 (0001) 0:**** ntdll!DbgBreakPoint
2 e 00414dd8 0001 (0001) 0:**** windb!atol “.echo shucks”
bp0 0x00401150 ;
bp1 0x7c90120e ;
bp2 0x00414dd8 “.echo shucks”;
Closing open log file c:\documents and settings\admin\desktop\nebp.txt

C:\Documents and Settings\Admin\Desktop>type nebp.txt
Opened log file ‘c:\documents and settings\admin\desktop\nebp.txt’
0 e 00401150 0001 (0001) 0:**** windb!main
1 e 7c90120e 0001 (0001) 0:**** ntdll!DbgBreakPoint
2 e 00414dd8 0001 (0001) 0:**** windb!atol “.echo shucks”
bp0 0x00401150 ;
bp1 0x7c90120e ;
bp2 0x00414dd8 “.echo shucks”;
Closing open log file c:\documents and settings\admin\desktop\nebp.txt

C:\Documents and Settings\Admin\Desktop>

On Wed, Jan 26, 2011 at 6:08 AM, Jonathon wrote:

> Hello all,
>
> is there a way to send a command to a text file? I know that $<
> redirects the file into the command line, is there a way to redirect
> the command output into a file?
>
> My reason for doing this is that I would like to record my current
> .bpcmds so that I can later reload them.
>
> Thanks,
> J
>
> —
> WINDBG is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


thanks and regards

raj_r

Thanks guys for the help. Do you know if there is a way to set
default PATHS for my scripts so that I do not have to provide the
entire absolute path when I use $

for example, in the example above, it would be nice to just do,
$<nebp.txt instead of provide the full path.>
I tried adding it to the source path, and it didn’t work.

On Wed, Jan 26, 2011 at 9:10 AM, raj_r wrote:
> i normally have a file in windbg folder that has these contents
>
>
> F:\windbg\612windbg>type dumpbps
> .logopen “${$arg1}”
> bl
> .bpcmds
> .logclose
> F:\windbg\612windbg>
>
> and use it like this
>
>
> 0:000> $$>a< dumpbps “c:\documents and settings\admin\desktop\nebp.txt”
> Opened log file ‘c:\documents and settings\admin\desktop\nebp.txt’
> ?0 e 00401150??? 0001 (0001)? 0:windb!main
> ?1 e 7c90120e??? 0001 (0001)? 0:
ntdll!DbgBreakPoint
> ?2 e 00414dd8??? 0001 (0001)? 0:windb!atol “.echo shucks”
> bp0 0x00401150 ;
> bp1 0x7c90120e ;
> bp2 0x00414dd8? “.echo shucks”;
> Closing open log file c:\documents and settings\admin\desktop\nebp.txt
>
>
>
> C:\Documents and Settings\Admin\Desktop>type nebp.txt
> Opened log file ‘c:\documents and settings\admin\desktop\nebp.txt’
> ?0 e 00401150??? 0001 (0001)? 0:
windb!main
> ?1 e 7c90120e??? 0001 (0001)? 0:ntdll!DbgBreakPoint
> ?2 e 00414dd8??? 0001 (0001)? 0:
windb!atol “.echo shucks”
> bp0 0x00401150 ;
> bp1 0x7c90120e ;
> bp2 0x00414dd8? “.echo shucks”;
> Closing open log file c:\documents and settings\admin\desktop\nebp.txt
>
> C:\Documents and Settings\Admin\Desktop>
>
>
>
>
>
>
> On Wed, Jan 26, 2011 at 6:08 AM, Jonathon wrote:
>>
>> Hello all,
>>
>> is there a way to send a command to a text file? ?I know that $<
>> redirects the file into the command line, is there a way to redirect
>> the command output into a file?
>>
>> My reason for doing this is that I would like to record my current
>> .bpcmds so that I can later reload them.
>>
>> Thanks,
>> J
>>
>> —
>> WINDBG is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>
>
>
> –
> thanks and regards
>
> raj_r
> — WINDBG is sponsored by OSR For our schedule of WDF, WDM, debugging and
> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the
> List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer</nebp.txt>

as i posted earlier create them in windbg folder :slight_smile: easy way

or if you

dont want to pollute windbg folder create a subfolder called scripts and
scriptresults for example in windbg folder

and use relative paths

all you have to remember is the name of relative :slight_smile: ie
.\scripts\

0:000> .shell tree /f /a scripts & tree /f /a scriptresults
Folder PATH listing
Volume serial number is B461-CD14
F:\WINDBG\612WINDBG\SCRIPTS
dumpbps
spat.txt

No subfolders exist

Folder PATH listing
Volume serial number is 00000073 B461:CD14
F:\WINDBG\612WINDBG\SCRIPTRESULTS
No subfolders exist

.shell: Process exited
Press ENTER to continue
<.shell waiting 1 second(s) for process>
<.shell process may need input>

0:000> $$>a< .\scripts\dumpbps “.\scriptresults\nebp.txt”
Opened log file ‘.\scriptresults\nebp.txt’
0 e 010550f0 0001 (0001) 0:**** windbg!wmain
1 e 7c810800 0001 (0001) 0:**** kernel32!CreateFileW “$$>a<
.\scripts\spat.txt”
bp0 0x010550f0 ;
bp1 0x7c810800 “$$>a< .\scripts\spat.txt”;
Closing open log file .\scriptresults\nebp.txt
0:000> .shell type .\scriptresults\nebp.txt
Opened log file ‘.\scriptresults\nebp.txt’
0 e 010550f0 0001 (0001) 0:**** windbg!wmain
1 e 7c810800 0001 (0001) 0:**** kernel32!CreateFileW “$$>a<
.\scripts\spat.txt”
bp0 0x010550f0 ;
bp1 0x7c810800 “$$>a< .\scripts\spat.txt”;
Closing open log file .\scriptresults\nebp.txt
.shell: Process exited
Press ENTER to continue
<.shell waiting 1 second(s) for process>
<.shell process may need input>

On Wed, Jan 26, 2011 at 11:03 PM, Jonathon wrote:er

> Thanks guys for the help. Do you know if there is a way to set
> default PATHS for my scripts so that I do not have to provide the
> entire absolute path when I use $
>
> for example, in the example above, it would be nice to just do,
> $<nebp.txt instead of provide the full path.>>
> I tried adding it to the source path, and it didn’t work.
>
> On Wed, Jan 26, 2011 at 9:10 AM, raj_r wrote:
> > i normally have a file in windbg folder that has these contents
> >
> >
> > F:\windbg\612windbg>type dumpbps
> > .logopen “${$arg1}”
> > bl
> > .bpcmds
> > .logclose
> > F:\windbg\612windbg>
> >
> > and use it like this
> >
> >
> > 0:000> $$>a< dumpbps “c:\documents and settings\admin\desktop\nebp.txt”
> > Opened log file ‘c:\documents and settings\admin\desktop\nebp.txt’
> > 0 e 00401150 0001 (0001) 0:windb!main
> > 1 e 7c90120e 0001 (0001) 0:
ntdll!DbgBreakPoint
> > 2 e 00414dd8 0001 (0001) 0:windb!atol “.echo shucks”
> > bp0 0x00401150 ;
> > bp1 0x7c90120e ;
> > bp2 0x00414dd8 “.echo shucks”;
> > Closing open log file c:\documents and settings\admin\desktop\nebp.txt
> >
> >
> >
> > C:\Documents and Settings\Admin\Desktop>type nebp.txt
> > Opened log file ‘c:\documents and settings\admin\desktop\nebp.txt’
> > 0 e 00401150 0001 (0001) 0:
windb!main
> > 1 e 7c90120e 0001 (0001) 0:ntdll!DbgBreakPoint
> > 2 e 00414dd8 0001 (0001) 0:
windb!atol “.echo shucks”
> > bp0 0x00401150 ;
> > bp1 0x7c90120e ;
> > bp2 0x00414dd8 “.echo shucks”;
> > Closing open log file c:\documents and settings\admin\desktop\nebp.txt
> >
> > C:\Documents and Settings\Admin\Desktop>
> >
> >
> >
> >
> >
> >
> > On Wed, Jan 26, 2011 at 6:08 AM, Jonathon wrote:
> >>
> >> Hello all,
> >>
> >> is there a way to send a command to a text file? I know that $<
> >> redirects the file into the command line, is there a way to redirect
> >> the command output into a file?
> >>
> >> My reason for doing this is that I would like to record my current
> >> .bpcmds so that I can later reload them.
> >>
> >> Thanks,
> >> J
> >>
> >> —
> >> WINDBG is sponsored by OSR
> >>
> >> For our schedule of WDF, WDM, debugging and other seminars visit:
> >> http://www.osr.com/seminars
> >>
> >> To unsubscribe, visit the List Server section of OSR Online at
> >> http://www.osronline.com/page.cfm?name=ListServer
> >
> >
> >
> > –
> > thanks and regards
> >
> > raj_r
> > — WINDBG is sponsored by OSR For our schedule of WDF, WDM, debugging
> and
> > other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
> the
> > List Server section of OSR Online at
> > http://www.osronline.com/page.cfm?name=ListServer
>
> —
> WINDBG is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


thanks and regards

raj_r</nebp.txt>