This tip will show you how to write the output of a command at the Windows command line to a file. It’s not hard (infact it’s one of the very basics of command line programming).
Start Command Line within Windows by choosing Start->Run then entering
cmd and pressing enter.
Suppose you want to capture the output from a directory listing, say
C:\blah. To get the directory listing to display on the screen you would type the command
dir C:\blah which may generate the output:
If you want to capture this listing to the file
c:\folder.txt then you would append
> C:\folder.txt to the original command, i.e.:
C:\>dir C:\blah > C:\folder.txt
Notice now that nothing appears on the command line window after this and it simply moves on to the next prompt. If we now check the file
C:\folder.txt then we see that it has the contents of the directory.
A slight variant of this is to use the greater than symbol,
>, twice, ie:
C:\>dir C:\blah >> C:\folder.txt
This will append the output of the
dir command to what is already contained in the file