How to Save the Command Prompt output to a Text File in Windows

Do you want to Save the Command Prompt’s output to a Text File in Windows? If you’re looking for a quick answer, then you’re at the right place. In this article, we are going to share the easiest way to save your command output into a .txt extension. You don’t have to download any other application for this, there will be only a few simple commands which will do the job for you.

As we all know, the normal output of the command prompt will remain in the box and will be vanished once you exit the program. Sometimes it’s hard to read all the lines because the result is quite bigger than our expectations. In that case, you might think that if we could just copy the whole text or save it as an external file for future preferences.

That’s why we are here to help you out and introduce you to the simplest way to save any command into your windows. All you have to follow is our instructions and we will guide you with step by step process so you don’t feel lost at any point. The process remains the same for all Windows versions, no matter if you’re using Windows 7/8 or 10.

The interface of the old command prompt and the new is a bit different, but the working process is as same as the old time. You don’t have to panic if our screenshot looks different from your program. Let’s begin with the steps without wasting any more minutes.

Save single command prompt’s output to a Text File

  • Open the command prompt, for that you just have to click on the start button of your desktop screen. Search for the query “cmd” it will ask you to verify the action if you want to open the app or not.
  • Click on the Run option and the command prompt will be opened on your screen.
  • Choose a destination to store all the text files you’re going to save through the cmd prompt.
  • In our case, we’re simply using the Drive D as our desirable spot for storage. It’s up to you, pick any location just remember the path.
  • As we have chosen Drive D, our location direction looks like this D:\. It might differ in your case, depends on your location.
  • Now, you have to run some commands to test the operation command of saving your data in local drives.

Let us show you an example of the whole process so you could understand all the little details regarding this trick.

  • Open command prompt, enter any query. ping
  • Now the results came into the cmd prompt and you’ll have no other to save the file, you can just scroll the output or read it as long as the page is available.
  • To save this desired result, you have to add a greater than “>” symbol after the command, and then write the path location where to want to save the file.
  • Don’t forget to add .txt after the file name, it’s a must-do action. Without this, your file will be treated as a system document that you can’t open with your Windows Software.

Take a look over the whole command for better visuals, ping>D:\NewFile.txt

Here, in this query we have entered the query, location of storage, file name.

  • ping = leads you to the output result in the command prompt.
  • > = is the action command used to tell the prompt that you want to save the results.
  • D:\ = your Drive D location where the document is going to be saved. If your location is different from ours, reply to the word D with your path. Don’t forget to add :\ at the end of the location.
  • NewFile.txt = It’s the file name by which the output is going to be saved in the drive. Add .txt at the end of the file name to store it as the same extension, or it won’t work if you forget to mention .txt.

Multiple Commands

If you want to save multiple commands in the same text file, just use the two greater than “>>” signs. Both two outputs will be saved according to the text file.





You’ll see that both the output results are available in the same NewFile.txt document in order without spoiling any word arrangements.

Now you can see the output is saved into your Drive and you can open it anytime you want.

Note: Use a different file name every time you try to save outputs, if you don’t change the file name it will replace the new file with the previous one, without any warning.


So this was all about how you can save the command prompt output to a text file in Windows. Hope you guys have learned the new thing, if this article seems useful to you don’t forget to share it with your buddies.

Leave a Comment