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.
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: