The classic way of copying data from the command prompt is the following:
- right click on the command prompt window title and choose Edit -> Mark command
- select the text inside the command prompt using the mouse
- to copy the selected text, right click on the command prompt window title and choose Edit->Copy command (or just press Enter on the keyboard).
If you have Quick Edit Mode enabled, then you can skip step 1 and directly drag to select and press Enter.
In Windows Vista, Microsoft has added a new way, which is quite handy and does not require so many clicks - the clip command. The clip command can accept the output of any console tools and send it to the Windows clipboard. Let's look how it can used with the following simple example.
Let's copy to the clipboard, the output of the dir command, which prints the given directory listing into the console.
In the screenshot above, you can see the result of the dir command. Let's modify the command, and combine the dir command with the clip command. Enter the following:
dir | clip
Note that the middle vertical bar is not capital 'i' or small 'L', that character is called the vertical bar or pipe. It is located above the '\' key. Press Shift+\ to enter it.
The output of this combination at the console will be empty:
Why? Because all of the console output results are sent directly to the clipboard!
Run the Notepad application (or your favorite text editor) and press CTRL+V to paste. You will get the directory listing in there:
Bonus tip: specially for the dir command, you can specify the /b switch, which will strip out the additional info from the output but will keep only file names. Modify the command to make it look like this:
You will get the following output in the clipboard:
Bonus Tip: clip.exe also ships as part of Windows XP Professional x64 Edition, so you could copy the 32-bit EXE for clip.exe from C:\Windows\syswow64 to Windows XP 32-bit edition too.
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!