How to Copy Command Prompt Output Text to Clipboard or File

Windows Command-line tools are great for troubleshooting, as well as automation. But, if you’re stumped when a tech support guy on the phone asks you to run a built-in console command and copy the output displayed for diagnosing a problem, these Command Prompt basics will come in handy.

This post explains how to copy or redirect Command Prompt output to a file or the clipboard.

Copy Command Prompt Output Text to Clipboard or File

Opening a Command Prompt window

To open a Command Prompt window, press WinKey + R to launch the Run dialog. Type in cmd.exe and press Ok. In Windows 8.1 and Windows 10, you can right-click Start and click Command Prompt. There are several other ways to open Command Prompt.

Command Prompt window

If the console tool you’re running or the operation you’re performing requires administrative privileges, you need to open Command Prompt as administrator (also known as “elevated” Command Prompt.)

In the Command Prompt window, type in the command you want to run. For example, someone who’s helping you wants to know your system information by running SystemInfo command, type systeminfo and press ENTER.

copy command prompt output

Copying the output to clipboard

To copy the command prompt output to the clipboard, use one of the methods.

Using Keyboard: Press Ctrl + A to select all text, and press ENTER to copy it to the clipboard.

Using the Edit menu: Right-click the Command Prompt title bar → EditSelect All. Repeat the same, and this time, select Copy from the Edit menu.

copy command prompt output

Using Clip.exe console tool: The Clip.exe console tool is built-in to Windows, starting with Windows Vista and up to Windows 10. This tool copies the data redirected or passed to it, into the clipboard. You can redirect the output of your console tool or command to the clipboard using the built-in Clip.exe tool by piping the output. The command you’d run is:

systeminfo |clip

That would copy the output of the systeminfo command to the Windows Clipboard. This is done by Clip.exe receiving the command-line output directly.

Once the output is sent to the clipboard, you can paste it into a text editor. For example, you can open Notepad and paste (Ctrl + V) the contents there.



copy command prompt output

Redirecting the output to a new file

You can redirect the command-line output to a file instead of Clipboard. This method can be useful if the output is too lengthy, containing several hundreds of lines that can easily exceed the Command Prompt window’s screen buffer size. To output the results to a file, use this syntax/examples:

systeminfo >%temp%\systeminfo.txt

That would create a file named systeminfo.txt in the user’s Temp folder. To write the output to a file on your desktop, you’d use:

systeminfo >%userprofile%\desktop\systeminfo.txt

Redirecting the output to a file by appending

The previous command would create a new file or erase the previous file (if one exists with the same name). If you want to append the command-line output to a file, use double greater-than symbols >>, as below:

ipconfig >>%userprofile%\desktop\systeminfo.txt
systeminfo >>%userprofile%\desktop\systeminfo.txt

That would output the contents of Ipconfig and Systeminfo commands to the same file. If a file exists with the same name systeminfo.txt, it would be used. Otherwise, a new file would be created.

Another example

ipconfig >%userprofile%\desktop\info.txt
sc query wuauserv >>%userprofile%\desktop\info.txt
dir d:\tools\*.exe >>%userprofile%\desktop\info.txt
dir C:\Windows\System32\Tasks /s /b >>%userprofile%\desktop\info.txt

Command Prompt window

The first command would create a new file (as a single > symbol is used) named info.txt. Subsequent commands would output the results to the existing info.txt file (double >> symbol).

Take a Screenshot

In some cases, you may not require the text output, and a screenshot is sufficient. Win + PrntScrn keystroke is used to take a screenshot quickly in Windows 8 and 10. Or use the excellent built-in Snipping Tool. Check out How to Take a Screenshot in Windows for a detailed guide.

I hope this guide helped you learn how to copy or redirect Command Prompt output to a file or the clipboard.


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support. It won't take more than 10 seconds of your time. The share buttons are right below. :)

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a consecutive ten-time recipient of the Microsoft Most Valuable Professional award in the Windows Shell/Desktop Experience category, from 2003 to 2012. He loves to troubleshoot and write about Windows. Ramesh founded Winhelponline.com in 2005.

2 thoughts on “How to Copy Command Prompt Output Text to Clipboard or File”

Leave a Reply to BBW Cancel reply