Pages

Thursday, October 20, 2011

Copy CMD Output Directly To The Clipboard

The Windows command line prompt can be handy at times and sometimes even the only option to execute a specific command in the operating system. You sometimes may need to copy the output of a command to the Windows Clipboard, for instance to use the output in another application. Most users that I know handle this either by sending the output to a file with the > filename.ext command or by frantically trying to figure out a way to select and copy the output contents in the command prompt window directly.

Both methods are not really straightforward and need more time than the process should take in first place. Thankfully though there is a way to copy command prompt outputs directly to the Windows Clipboard, it is only lesser known.

Open the command prompt as usual. You can open it with standard rights or elevated rights by right-clicking on the icon in the start menu and selecting to run it as an administrator.

Once there you can copy any output to the clipboard by appending | clip at the end of the command. A basic example is the dir command which outputs all folders and files of the current directory level directly in the command prompt. Please note that you won’t see the output anymore on the screen as it is redirected to the clipboard.

windows clipboard output

  • dir – output in the command prompt
  • dir > test.txt – output copied to the file test.txt in the same directory.
  • dir | clip – output copied to the clipboard

The directory command is only a basic example to demonstrate the effect of the | clip command. You can obviously use it for complex commands and outputs as well. Whenever you use the clip command everything that is part of the output is copied to the Windows clipboard.

Did you know about the clip output command? If not, how did you copy the command prompt output until now?


© Martin Brinkmann for gHacks Technology News | Latest Tech News, Software And Tutorials, 2011. | Permalink |
Add to del.icio.us, digg, facebook, reddit, twitter
Post tags: , , ,



0 comments:

Post a Comment