No, not quite like the good old days.
- By Greg Shields
If you're one who desperately misses ol' Clippy from Microsoft Office, please let me know. I know he's gone the way of the dodo for most of us, but there are still a few holdouts who miss those craaaazy antics! (Viva, Microsoft Bob!...)
Seriously though, this week's trick is one with a sordid past. Like you, I've struggled with the multi-step 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.
Tech HelpJust An
Got a Windows, Exchange or virtualization question
or need troubleshooting help? Or maybe you want a better
explanation than provided in the manuals? Describe
your dilemma in an e-mail to the MCPmag.com editors
the best questions get answered in this column and garner
the questioner with a nifty Redmond T-shirt.
When you send your questions, please include your
full first and last name, location, certifications (if
any) with your message. (If you prefer to remain anonymous,
specify this in your message, but submit the requested
information for verification purposes.)
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!
Greg Shields is Author Evangelist with PluralSight, and is a globally-recognized expert on systems management, virtualization, and cloud technologies. A multiple-year recipient of the Microsoft MVP, VMware vExpert, and Citrix CTP awards, Greg is a contributing editor for Redmond Magazine and Virtualization Review Magazine, and is a frequent speaker at IT conferences worldwide. Reach him on Twitter at @concentratedgreg.