Get Command Prompt Output in Text File or Clipboard

Here is how you can Export Command Prompt output in a Text File or Paste it to the Clipboard

Microsoft’s Windows uses a pretty intuitive Graphical User Interface (GUI), based on a concept where each application operates within the confines of a window, which can be minimized, maximized, or resized, making it perfect for multitasking. However, hardcore users still rely on the functionality and ease of using a command-line interface like the Windows PowerShell or the Command Prompt, whichever you are more comfortable to use.

However, unless you know your way around the Command Line Interface, you will find yourself that there are dozens of functionalities that you don’t know about. For example, recently, Microsoft also introduced the ability to be able to copy or paste in a CLI (right-click and Paste or even double-tap on the touchpad to paste if your PC supports it). Similarly, there are a ton of text-based utilities that you can use from Command Prompt, like using the Telnet Client to communicate with a server, or being able to trace route or ping an IP in Windows.

There are also utilities that allow you to get some really critical information about your PC using the Command Prompt, from finding your computer’s IP address to revealing the saved WiFi passwords. For these details, it is helpful to be able to export all the details to file or even copy them to the clipboard to save them in a file. Fortunately, Microsoft has a built-in utility to allow you to do exactly that.

Export Output to a Text File

  1. Open the Command Prompt or Windows PowerShell, whichever is your preferred CLI. For our convenience, we will be demonstrating this using the Windows Command Prompt. You can open it by searching for cmd from the Windows Search.
  2. Type the command that you want to execute. For example, if we want to ping an IP to check its status and want to save all the details into a text file, we will type the ping command followed by > <filename>ping google.com > abc.txt
  3. It will save the output in a text file called abc.txt in the directory where the Command Prompt is opened. You can see the directory on the left behind the cursor, as seen in the screenshot below.
  4. Alternatively, you can also give the complete path where you want to save the file to along with the name, as shown in the screenshot below.

Export Output to Clipboard

  1. Open the Command Prompt or Windows PowerShell, whichever is your preferred CLI. For our convenience, we will be demonstrating this using the Windows Command Prompt. You can open it by searching for cmd from the Windows Search.
  2. Type the command that you want to execute. For example, if we want to ping an IP to check its status and want to save all the details into a text file, we will type the ping command followed by > <filename>ping google.com | clip

  3. It will copy the complete output of the command to the clipboard. You can simply paste it anywhere by right-clicking in a document or a text file and clicking on Paste or using the CTRL + V shortcut.