Command line tip #5 - How to save the output of a command to the clipboard with clip.exe

Tip #4 showed how to save the output of a command to a text file. However, sometimes you may want to be able to insert the output into some other type of file. In that case, sending the output to the clipboard will do the trick. In Vista, there is a utility file called clip.exe that provides this capability. To use the utility, we make use of a command-line feature called the “pipe”. For example, to send the output of a “dir” command to the clipboard, enter: dir “C:\my folder” /s /q ¦ clip.exe

Note the symbol “¦”. This is the “pipe” symbol and, when it separates two commands, sends the output of the first command as input for the second command. On most standard keyboards, it is the broken bar located above the backslash symbol “”. When typed, it is often represented as a solid symbol “|”.

Windows XP does not come with the clip.exe file but the Windows Server 2003 version will work in XP and it can be downloaded at Daniel Petri’s site. Unzip the file to the folder Windows\system32.

Comments are closed.