Copying command-line results to the clipboard in Vista

In this month’s MCP magazine, Greg Shields wrote about using clip.exe to get command line output onto the clipboard where you can easily use it by pasting into your favourite app, such as Notepad, OneNote or Excel (if you need to parse the results down).

“Like you, I’ve struggled with the multistep process to get data from the results of a command into a text file. If you want to run the runme.bat script and capture the results, you’d launch the command and copy and paste the results into Notepad or another text editor. Or, you might pipe the results to a file using the > character. If you’re particularly skillful, you could redirect both stdout and stderr to a text file with the text string:

runme.bat 1> results.txt 2>&1

But what if you simply wanted to pipe the results to the clipboard?
Way back in the old days, the Windows NT and Windows 2000 Resource Kit had a tool called clip.exe that allowed for this. Just run:

runme.bat | clip

and use Ctrl+V to paste the results into your text file. With Windows 2003, the tool moved out of the Resource Kit and is now installed natively with the operating system. But there appeared to be nothing comparable for Windows XP, so I slowly forgot about it.
That is, until recently — when I realized that one could simply copy clip.exe from C:\Windows\Systems32 on any Windows 2003 Server to the same location on an XP workstation and rejoice for the happy return of Command Line Clippy!”

What Greg forgets to mention is that this functionality is also natively installed on Windows Vista, ready and available for easy use.

Advertisement

About Adam Vero
I'm a self-confessed geek, IT consultant and trainer. By day I'm the owner of Meteor IT Ltd, a Microsoft Dynamics CRM consultant, Microsoft Certified Trainer and MS Office Master Instructor.

Tell me what you think...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 86 other followers