This Simple Trick Saves Command Prompt Output to a Text File
Pinterest Stumbleupon Whatsapp
Advertisement

You’ve probably heard of the Command Prompt and know that it’s a great Windows tool for quickly performing useful actions. With just a few keystrokes, you can change settings and check information that would take a dozen clicks through normal windows.

But the Command Prompt is still a bit cold. While you can copy text from it to share with others, it’s a bit finicky. If you need to share some output from the Command Prompt on a forum or want to save the output for troubleshooting purposes, there’s a quicker and better way to do so.

The trick is to append a bit of text before the command. For instance, let’s say we want to run the ipconfig command to get a list of basic network information. Typing ipconfig into the Command Prompt will output the pertinent info to the Command Prompt window, and you’ll lose it once it’s closed. Instead, use this format to output the info to a text file called NetworkInfo:

ipconfig > NetworkInfo.txt

Typing a filename without any location will place it at C:\Users\USERNAME where you can access it. To specify a location, add it like so:

ipconfig > C:\Users\USERNAME\Desktop\NetworkInfo.txt

You won’t see any output in the Command Prompt window. It all appears in that file instead. If you want to append some output to an existing file, use two >> symbols like this:

ipconfig >> NetworkInfo.txt

This will add the second output to the file, instead of completely overwriting it like a single > would.

Using this method, you can compare the output of a command before and after a change, keep a record of some system statistic for later, or just use a better text editor to search the data. It’s pretty handy for anyone who works in the Command Prompt often.

If you found this useful, make sure to review other great tips for improving the command prompt.

Have you ever saved Command Prompt output to a text file? What was your reason for doing so? Tell us down in the comments!

Image Credit: Simple Icons via Wikimedia Commons

Leave a Reply

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

  1. Alex
    June 6, 2017 at 4:15 am

    Damn, this is all it takes to be a blog writer? I should get started!

    • Ben Stegner
      June 6, 2017 at 4:18 am

      Yep, this is all it takes. Let me know how it goes for you!

  2. Sam McCormack
    June 5, 2017 at 2:41 pm

    That's useful, but cmd will never beat bash and zsh :-)

    • Steve
      June 5, 2017 at 3:37 pm

      CMD was never meant to. Windows 10 has its own bash and PowerShell is the new command line of choice. CMD will never go away hundreds of thousands of batch files used by enterprises ensured that.

      • Sam McCormack
        June 5, 2017 at 3:40 pm

        Indeed. (Though I doubt that Powershell will beat the Linux shells any time soon.)