Monday, January 26, 2009

Output MS-DOS command prompt to file

If you've ever wanted to keep a log of what you're doing in command prompt, but didn't know how, that's about to change. It's surprisingly simple. The key is the ">" symbol. You have two options, output/overwrite or append.

If you want to log a traceroute to, the command would be:

tracert > C:\log.txt

It's that simple! That will output all of the feedback from the command into a file named "log.txt" at the location you specified, which is just the C drive in this case.

If you want to append to that log a traceroute to, the command would be:

tracert >> C:\log.txt

Using ">>" in this command means append, and we specify the file we had created in the first command.

You can use this for batch scripts, or for keeping track of what you've actually been doing in the command prompt. If you're using Windows Vista, make sure you are running the command prompt as Administrator. If you don't, you'll get an access denied error. If you don't know how, just right-click on the Command prompt icon in your Start menu, then select "Run as administrator". That will give you the necessary permissions

1 comment:

Anonymous said...

Thank you so much! It worked like a charm! I have been dealing with problematic nVidia drivers for quite a while!