IDG logo

Advertise with InfoWorld

SiteMap News Test Center Opinions Forums Careers Stock Quote Subject Indexes About Us Search Subscribe Home [Window Manager]

January 29, 1996

Define shortcut on context menu to tame pesky tasks

In the past two weeks, I've described time-saving ways to use your right mouse button to handle files in the Windows 95 Explorer. If you missed those columns, the trick is to use the Send To item on the pop-up menu (called a context menu) that appears when you right-click a file name. You can send a file to an application, a folder, a printer, and so on. Right-clicking a file name, clicking Send To, then clicking an object name accomplishes the same thing as dragging and dropping that file name into the object's window. An application opens the file, a printer prints it, and so on.

To add an object to your Send To list, right-drag its file name into your C:\Windows\SendTo folder and then click Create Shortcut Here.

One of the biggest limitations of the Send To menu item, which I mentioned last week, is that you cannot configure a Send To command line with parameters. Say you have .TXT files associated with Notepad, but you frequently want to print .TXT files using WordPad. Printing text files with WordPad, for example, doesn't automatically add headers and footers to the output, as Notepad does. Adding /P as a parameter to WORDPAD.EXE's command line in a Send To shortcut doesn't work. Windows ignores any parameters that follow the executable name in the shortcut. (To see the command line underneath a Send To shortcut, right-click the shortcut in the C:\Windows\SendTo folder, then click Properties, Shortcut.)

The best way to get around this is to define a shortcut that will appear on your context menus and let you do anything you desire. It lets your right mouse button select a file and launch almost any action you can think of.

It's easy to define a new action for all files with a particular extension. Here's how to create a new context menu item, which appears when you right-click a .TXT file in Explorer, that automatically prints text files through WordPad rather than Notepad:

Step (1) On the Explorer main menu, click View, Options, File Types.

Step (2) In the list of Registered File Types, scroll down and select Text Document, then click the Edit button, then the New button.

Step (3) In the New Action dialog box that appears, type Print Using WordPad as the Action. In the Application Used To Perform Action box, type the following:

"C:\Program Files\Accessories\WordPad.exe" /P

In this example, the quotes are necessary because the folder name contains a space. The parameter /P causes WORDPAD.EXE to print any .TXT file you right-click.

Step (4) Click the OK button, then click Close twice to exit the dialog boxes. That's it!

Back in the Explorer window, find a .TXT file and right-click it. You should see a new item on the context menu: Print Using WordPad. Click this choice. You should see WordPad flash for a moment as it reads the file and automatically sends it to the printer.

I find that I prefer associating text files with Notepad, which opens files for viewing a lot faster than the sluggish WordPad, but I prefer to print text files using WordPad.

You can create all kinds of commands for all types of files. Many applications support a variety of command-line switches that launch different kinds of behaviors on files you open. Microsoft Word for Windows, for example, supports the parameter /mcommand. By using /mFilePrintPreview with .DOC files, for example, you can open documents in Print Preview mode rather than the normal view. (On Word's main menu, click Tools, Customize, Menus to see other possible commands.)

Brian Livingston is the coauthor of the new Windows 95 Secrets and author of three other Windows books (IDG Books). Send tips to or fax: (206) 282-1248.

Missed a column? Go back for more.

Copyright © 1996 by InfoWorld Publishing Company


Copyright © 2002. InfoWorld Media Group, Inc. is a member of complies with the ASME guidelines with IDG extensions For New media.