Direct Output to Text File from Command Prompt

·

·

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.

command-prompt-output-to-notepad
command-prompt-output-to-notepad

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.


Leave a Reply

Your email address will not be published. Required fields are marked *