SoFunction
Updated on 2025-04-03

dos content redirection

Is there a way to save the help information displayed in the command line window?

The answer is yes, and there are more than one answer.

A slightly more cumbersome way is to copy the information in the command line window and paste it into the text to save it. This operation is quite cumbersome: right-click in the command line window, then select "Tag", use the mouse to pull out the copy range, then press Enter, and finally paste it into the text.

An efficient way is to use redirection symbols to redirect the information originally output to the cmd window to a text file.

There are two redirect symbols: > and >>. Their functions are to change the output direction of various prompt information and output the prompt information to a designated place - various prompt information are output to the screen by default. For example: tree /?>, this command statement redirects the help information of the tree command to the file, and help>nul redirects the prompt information of the help command to an empty device (nul means an empty device).

Want to see what basic commands are available in cmd? Enter help in the cmd window and you will see it; if you want to save these basic command information, please use help>d:\, and then go to the root directory of the D disk to find the file and open it.

> and >> Although both play the role of redirecting prompt information, their functions are slightly different. A single > means redirecting prompt information in a overview manner, that is, if the destination originally had content, the original content will be cleared and filled with new content; >> means redirecting prompt information in an append manner, that is, if the destination originally had content, the original content will remain unchanged, and new content will be added after the original content. For example: Suppose the content in d:\ is: I Love batch. Then, in the cmd window, use the following two statements: echo me,too>d:\ and echo me,too>>d:\. You will find that after using the first statement, there is only one line of content: me,too, and after using the second statement, there will be two contents, namely I Love batch and me,too.