Exporting command prompt results in text files

When you input a command in Command Prompt, the output is displayed just below the input in the command prompt window. This is the fact that we all know about. But for some commands, the output can be several pages long, causing you to scroll to view all of the output and harder to find the thing you are searching for.

But with this simple trick, you can get rid of such long listing outputs. For example, when listing directory (However, you can input dir /p/w for page wise view) of folder which has large numbers of files and folders. You may need it in a separate text file to search for the specific files or folders.

To export all the output of the command prompt in text files. Simply follow the following syntax.

C:\> [syntax] >file.txt

The above command will create result of syntax in file.txt. Where new file.txt will be created on the current folder that you are in.

For example,

C:\Result> dir >file.txt

It will create new file named, file.txt in folder named Result in C: drive with all the outputs of the input command.

You can also specify specific location for the output result.

For example,

C:\>dir > C:\Result \lists.txt

Next time when you use the same command, dir >file.txt, it will overwrite the previous output results in file.txt. But you can send output in new line in file.txt without overwriting it.

For example,

C:\dir >>file.txt

It will create new output in the next line in file.txt.

Hope this was informative. Share this post by clicking the link below that is favorable to you.

You can leave a response, or trackback from your own site.

Leave a Reply