How to save DOS and shell output to a file

This is an old trick that does not get much use these day. But, from time to time I need to run something in DOS or in shell (terminal) and save the output.

For example, say that I need to list a directory out and write into a Word document. I could fight with the the DOS screen copy function in Window. Or with a simple use of “>” I can save the information to a file.

dir > c:\root_directory_list.txt

This should work with just about everything that you can write to the terminal window. And, comes in handy with logging ping, traceroute, nslookups, and netstat.