Saving the output of a Windows Command Prompts 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, a redirection.
If, for example, you wanted to save the output of the DIR function to a text file instead of scrolling for page after page on your screen in the command window, you would execute the command
c:\> dir > sample.txt
in the code above above, where we’ve run the DIR command from the C: directory and saved the output to a text file stored as “sample.txt”.
Notice that the output is not displayed in the command window above, but when we open the text document, we see the full command output:
Any command that has a command window output (no matter how big or small) can be appended with “>” filename.txt and the output will be saved to the specified text file.
In addition to executing the command as a one-off affair, you can also tweak the command slightly in order to dump sequential output to the same text file for your convenience.
Let’s say, for example, you want to send the output of the same command to the same text file before and after you make some change (e.g. rebooting your router and acquiring a new IP address).
You can first issue the command with a single angel bracket “>” and then repeat future instances of the same command with a double angle bracket “>>”
c:\> dir >> sample.txt
Related posts
0 Comments
Leave a Reply Cancel reply
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Subscribe for newsletter
* You will receive the latest news and updates on your favorite topics!
How to Downgrade Flutter Version – FIXED
Learn how to downgrade your flutter version to a lower version, in this article we will reduce the flutter version…
Generate Resources for Android Playstore & iOS Apple Store Flutter
In this post, we’ll generate resources for the flutter app we created in the previous post. we’ll be learning how…
Build a Quiz App using Flutter for Android and iOS
In this post we’ll be working with Flutter, a fast-rising Developer tool built by Google to develop an Android App,…
Setup Flutter on Kali, Ubuntu, and any other Linux Distro
In this post, we’ll be learning how to set up your Flutter on Linux for development. Flutter is a fast-rising…
FIXED xcodebuild: Failed to load code for plug-in – Repeatedly Being Asked to Install Command Line Tools
Hey there, updating your MacOS Montery Xcode can be a pin in the a$$ especially when you got Xcode working…
How to Downgrade Flutter Version – FIXED
Learn how to downgrade your flutter version to a lower version, in this article we will reduce the flutter version…
Build a Quiz App using Flutter for Android and iOS
In this post we’ll be working with Flutter, a fast-rising Developer tool built by Google to develop an Android App,…
Setup Flutter on Kali, Ubuntu, and any other Linux Distro
In this post, we’ll be learning how to set up your Flutter on Linux for development. Flutter is a fast-rising…
Hi Vincent and thankyou for sharing all these great tips and knowledge. With reference to your video on Youtube Part 4 – How To Create an Automated Invoice/ Receipt – Excel 2016. What a great video and thankyou for sharing it. If I wanted to change this so the final saved sheet has the worksheet name + date + 1 specific cell value i.e. the customer name how would i edit your code please. Many thanks again.