Friday, October 28, 2011

CMD Print DIR to text file

dir > print.txt

The ">" symbol is telling to put the output of the command to whatever is next. In this case "print.txt". This is useful for writing any output to a file in a script or whatever.

Example: dir > %USERPROFILE%\Desktop\print.txt

This example will print the directory listing to print.txt on your desktop.

Other flags:

dir /b file names only

dir /s include all sub folders & files

Original source: http://www.computerhope.com/issues/ch000772.htm

Actually I really like that site, and spent some time taking their quiz. Entertaining.

No comments:

Post a Comment