Windows

Automate Vista's Clip command line utility

Greg Shultz shows you how to use the Creative Element Power Tools to add the further automate the Clip utility by adding it to the context menu in Microsoft Windows Vista.

As you may know, Microsoft Windows Vista includes a nifty little command line utility called Clip.exe that that is designed to redirect or pipe the output generated by a command line utility to the Windows clipboard. This can come in handy in a lot of different situations as it allows you to quickly get information from the command line into a Windows application. Using the Clip command is as easy as adding the pipe or the redirection symbol along with the clip command on the command line.

For example, you can use the Clip utility along with the pipe symbol to copy a directory listing to the clipboard:

Dir | clip

Or you can use the Clip utility to copy the results of the Ipconfig command:

Ipconfig /all | clip

You can use also use the Clip utility along with the redirection symbol to copy the entire contents of a text file to clipboard:

Clip < Readme.txt

While each of these uses of the Clip utility can come in handy, the last one was of particular interest to me as I regularly copy the contents of a text file and paste it into a Word document. The more I thought about this capability the more that I wished that I could automate it and make it available in Windows graphical user interface.

As I pondered the possibilities, it occurred to me that the best way to make this happen would be to add the Clip utility to the context menu. I used that technique several times in Windows XP to add DOS commands to the context menu via the File Types tab in the Folder Options dialog box.

However, as I proceeded in that direction and opened the Folder Options dialog box I remembered that Microsoft had removed the File Types tab from Vista's Folder Options dialog box and replaced it with the Default Programs application. While the Default Programs application provides you with the basic features from the File Types tab, such as working with file type associations, it unfortunately doesn't provide you with the in-depth functionality as File Types tab and thereby no way to add commands to the context menu.

That meant I had two alternatives: Find a third-party utility or to delve into the registry via the Registry Editor.

If at all possible, I prefer to avoid editing the registry, if I can. Fortunately, while searching for an alternative to the File Types tab, I found a very nice utility called Creative Element Power Tools that includes a feature called the File Type Doctor that provides many of the features from the File Types tab.

In this edition of the Microsoft Windows Vista and Windows 7 Report, I'll show you how to use the Creative Element Power Tools to add the Clip utility to the context menu in Vista.

This blog post is also available in the PDF format in a TechRepublic Download.

The Creative Element Power Tools

The Creative Element Power Tools is a program from Creative Element that provides quite an extensive collection of productivity tools. Some of the tools run from the user interface while others, such as the File Type Doctor, run as an extension to the operating system. This program is shareware and installs with a 45-day evaluation period. After the evaluation period, you'll need to register or the program will expire. Registration costs $18.00.

After you download the Creative Element Power Tools, installing it is a snap. You just follow the steps presented by the setup wizard

Using the File Type Doctor

Once you've installed the Creative Element Power Tools, launch it and respond with the appropriate action in the User Account Control dialog box. You'll then see the program's Control Panel where you enable and configure the various tools. To enable the File Type Doctor, scroll down to and select the Edit File Type Associations check box, as shown in Figure A. Then click the Accept button.

Figure A

You'll enable the File Type Doctor from the Creative Element Power Tools' Control Panel.
For the next step, you'll launch Windows Explorer, locate and right click on a .TXT file, and then select the new Edit File Type command, as shown in Figure B. As soon as you do, you'll see the File Type Doctor window shown in Figure C.

Figure B

Once you enable the File Type Doctor, you'll find the Edit File Type command on the context menu.

Figure C

The File Type Doctor's interface is very comprehensive.
To add the Clip utility to the context menu and configure it to copy the contents of a text file to the Clipboard, you'll begin by clicking the Add button. When you see the Add New Action dialog box appear, you'll type a name for the command in the first text box, the path to Cmd.exe in the second text box, and then type the command line parameters to launch the Clip utility in the third text box as shown in Figure D. To proceed, click the Accept button and then close the File Type Doctor.

Figure D

To add the Copy to Clipboard command to the context menu for .Txt files, you'll fill in the Add New Action dialog box as shown here.
Now, anytime you want to copy the contents of a .Txt file to the clipboard, simply right-click on the file and select the Copy to Clipboard command from the context menu, as shown in Figure E. Keep in mind that when you do, you'll momentarily see a Command Prompt window and there will be a slight delay before contents are copied. However, you can then switch over to your application and simply paste the content into your document.

Figure E

You can now easily copy and paste the contents of a text file into another document.

What's your take?

Do you use the Clip utility? Do you regularly copy and paste the contents of a text file into another document? Have you missed the File Types tab in Vista's Folder Options dialog box? Will you make use of the Creative Element Power Tools?

TechRepublic's Windows Vista and Windows 7 Report newsletter, delivered every Friday, offers tips, news, and scuttlebutt on Vista and Windows 7, including a look at new features in the latest version of the Windows OS. Automatically sign up today!

About

Greg Shultz is a freelance Technical Writer. Previously, he has worked as Documentation Specialist in the software industry, a Technical Support Specialist in educational industry, and a Technical Journalist in the computer publishing industry.

7 comments
Photogenic Memory
Photogenic Memory

| Pipes | is a great way to combine programs together to forward the data-stream of one command function into the other for parsing/processing or whatever you need. However, your missing out on other types of redirection such as "" or "". General expression is a whole language in itself in which I continue to slowly master( if ever ). Anyways; in short, you can just redirect the info like so: dir > directorylisthere.txt or if you need to append more data without over-writing the first entry; just do this: hostname >> directorylisthere.txt I guess the real problem here is that I made a new text file instead of this info being copied to a temporary memory buffer so I can do a ^v command on a text document. Can't I just highlight the screen output in an DOS shell in the GUI and do a ^c and then ^v to a new text document?

fkowal
fkowal

Either i am missing something about the clip option that Greg wants to do OR he is missing out on what Creative PowerTools can do already, I have not used it, but on the web page it states it has this "Copy file contents to the Clipboard - Right-click a text or graphics file and select Copy File Contents to copy the file to the Clipboard without opening it. Of course then you paste wherever you want.

Mark W. Kaelin
Mark W. Kaelin

Do you use the Clip utility? Do you regularly copy and paste the contents of a text file into another document? Have you missed the File Types tab in Vista's Folder Options dialog box? Will you try the Creative Element Power Tools? Do you have another set of power tools that you prefer over the ones from Creative Element?

TexasJetter
TexasJetter

"Can't I just highlight the screen output in an DOS shell in the GUI and do a ^c and then ^v to a new text document?" No, the ^c and ^v are not available in a DOS (Command Prompt). You can't directly highligh text either. To accomplish these actions you have to use the menu of the Command Prompt, by right clicking on the title bar you can Edit/Mark or Edit/Copy or Edit/Paste. So the |Clip tip is a great way of getting Command Prompt info to the clipboard.

Greg Shultz
Greg Shultz

...I was so focused on automating the Clip utility and finding a way to access the old File Type functionality that I completely missed the "Copy file contents to the Clipboard" feature built right into the Creative PowerTools. However, now that we know that we can access the File Types functionality via the Creative PowerTools we can take advantage of other uses of the Clip utility, such as copying ipconfig results to the clipboard.

RaceTrak
RaceTrak

Creative Elements shell extension tools do not yet work fully with 64-bit Vista (or more accurately, the 64-bit version of Windows Explorer in Vista...), so your method is the only way I can get the functionality! Thanks for the tip!