How to save the output of a CMD command to a text file or clipboard in Windows

Who I am
Catherine Le Nevez
@catherinelenevez
SOURCES CONSULTED:

support.microsoft.com

Author and references

How to save the output of a CMD command to a text file in Windows: - Sometimes when you run a command in Symbol of the system, you may feel the need to save it to an external file or copy it to the clipboard. For example, you get an error code every time you run a command. If so, you may want to save the command output somewhere so you can share it with a friend or post it on a forum to ask for help from the technicians present. Is there a quick way to do this? Yes I'm here! Dive into the article to find out all about this amazing trick.



Procedure for saving the output of a CMD command to a text file

1 STEP

  • Launch the file Symbol of the system in administrator mode. For this, start writing cmd in the search box and when the search results appear, right-click Symbol of the system and choose the file Run as administrator option. Some commands require administrator privileges to run. That's why we open the file Symbol of the system in administrator mode.

2 STEP

PHASE 3

  • The output of your command will be saved in the default location: C: Windows System32.

PHASE 4

  • If you don't want your file to be saved in the default location, you can specify the location and save the file there. I specified Desk as my file location, as shown as an example in the screenshot below. The format would be the same as before, the only change would be in the location details.



PHASE 5

  • Now you can go to the location where the file was saved and double-click on it to view its contents.


PHASE 6

  • That is. The output of your command is saved successfully.

Steps to copy the output of a CMD command to the clipboard

1 STEP

  • If you just want to copy the output of a command to the clipboard, you can follow the following format:

    yourCommand | clip

Note: The screenshot below is just an example. You can save the output of any command. It doesn't have to be ipconfig itself.


2 STEP

  • Now open notepad or any other editing application and try to execute the paste command. For this, you can right-click anywhere and choose the Paste option or you can use the key combinations CTRL + V.

PHASE 3

  • That is. The command output will now be correctly pasted into your editor from the clipboard.

Hope you found the article useful. If you have any questions about any of the steps, feel free to leave comments, we'll be happy to help. In the meantime, you can check out our articles on the topics 20 Useful Windows File Management Commands and 6 Basic Windows Command Lines Everyone Should Know.

add a comment of How to save the output of a CMD command to a text file or clipboard in Windows
Comment sent successfully! We will review it in the next few hours.