Saving the output of a Windows Command Prompt command is a great way to get a nice neat copy to share with support staff, analyze longer outputs using your favorite text editor, or otherwise interact with the output with more flexibility than staying in the command window allows for.
To redirect the output of a command to a text file instead of printing it to the screen in the command window, we simply need to execute the command and append it with the “>” angle bracket symbol—called, appropriately enough, a redirection.
If for example, you wanted to save the output of the DIR function to a text file instead of scrolling page after page on your screen in the command window, you would execute the command
DIR > some-descriptive-filename.txt
Read more - click here.