Direct Output to Text File from Command Prompt

by vbb on January 18, 2009

in Tips & Tricks

Sometimes you may need to copy contents from a command prompt window. Doing this is simple and I have already posted posted about it.

However problem may arise if you want to copy a large chunk of text from command prompt.For example if you want to get list of all files under system32 directory of Windows ,the above trick will be a pain to apply.In this kind of situation it’s good to direct the output of command prompt window to a text file.

Syntax for Direct Output to text file from Command Prompt

Just putĀ  a “Greater Than sign” (>)after the command and write the name of the text file.For Example if you want to get file listing under system32 directory just write

dir >desired_file_name.txt

The following figure shows how a text file is created with completeĀ  listing of system32 directory.



The text file ‘new.txt’ is located in D drive,as a path is also provided in the command.If you don’t provide the path,the text file will be created in the same directory from where you are issuing the command.

Enter your email address and subscribe for FREE updates

Or Get Full Updates through RSS Feed

Leave a Comment

Previous post:

Next post: