Hack 83 Launch Applications with Command-Line Shortcuts

Hack 83 Launch Applications with Command-Line Shortcuts

figs/moderate.gif figs/hack83.gif

Launch applications quickly and customize what they do when they run, by using command-line shortcuts, parameters, and switches .

Windows is a graphical operating system, but a lot of times all these pretty icons, menus , and clicking get in the way of getting work done. That's particularly true when you want to launch applications.

I started computing in the days of DOS, when real men and women didn't use mice and icons. (Sometimes because it wasn't an option.) So, I look for any chance I can get to use the command line, particularly when doing so saves me time and lets me take more control of my computer.

That's why I frequently launch applications using command-line shortcuts, along with parameters and switches. Parameters and switches let you customize the way programs launch. They're usually specific to each individual program, though some work on many or all programs.

An even bigger time-saver is to use the command line along with keyboard shortcuts. That way, you can press a key combinationsuch as Ctrl-Alt-W, for exampleand launch Microsoft Word with a new document open , based on a specific template.

9.5.1 Create Keyboard Shortcuts for Running Applications

You'll first, create a desktop shortcut to the application, and then you'll customize the shortcut so that it launches when you use a specific key combination. Right-click on the Desktop and choose New Shortcut. Enter or browse to the filename of the application for which you want to create a shortcut, including its path and surrounding it by quotation marks, such as " C:\Program Files\Microsoft Office\Office10\WINWORD.EXE " . Click Next; then, in the "Select a name for the shortcut box," type the name of your new shortcut (such as Basic Word ), and click Finish. Right-click on the shortcut you just created and choose Properties. In the Shortcut Tab, shown in Figure 9-5, put your cursor in the "Shortcut key" box and press the key combination you want to use to start the program. It has to be a combination of Ctrl-Alt, Shift-Alt, or Shift-Ctrl, plus a letter key, such as Ctrl-Alt-A, Shift-Alt-A, or Shift-Ctrl-A. In our instance, we're using Ctrl-Shift-W. Click OK. The program will now launch whenever you press the shortcut key combination.

Figure 9-5. The Shortcut Properties dialog box

There are a variety of entries on the Shortcut tab that let you customize how the program launches when you use the shortcut. The Run drop-down list lets you start the program minimized, maximized, or in a normal window. The "Start in" box lets you determine the start location for the application. You can even customize the ScreenTip that appears when you hover the mouse over the shortcut. In the Comment box, type the text you want to appear as a ScreenTip. Figure 9-6 shows how such a customized ScreenTip looks like when a mouse hovers over it.

Figure 9-6. A customized ScreenTip

9.5.2 Customizing Shortcuts with Switches and Parameters

Launching applications with a keyboard shortcut is a time-saver, but there's still a lot you can do to customize those shortcuts. For example, you can set up a number of separate keyboard shortcuts for Wordfor example, to launch Word with new documents based on a different templates, or to open Word to specific already-created documents.

For example, let's say you want to launch Word and have it automatically open a specific document, one called chapter 9.doc in the C:\Hacks directory. Type this (all on one line) in the Target box displayed in Figure 9-5:

 "C:\Program Files\Microsoft Office\Office10\WINWORD.EXE" "C:\Hacks\chapter 9.doc" 

Doing this gives you much more control that double-clicking on the document or creating a shortcut to the document, because, in addition to launching individual files, you can use a variety of switches to customize how you launch those files. For example, let's say you want to launch Word without the splash screen. Use the /q switch, like this:

 "C:\Program Files\Microsoft Office\Office10\WINWORD.EXE" /q 

You can then combine switches with opening individual files, like this:

 "C:\Program Files\Microsoft Office\Office10\WINWORD.EXE" /q "C:\Hacks\chapter 9.doc" 

This command opens the file and bypasses the splash screen. Use keyboard shortcuts along with these switches and syntax to create as many customized versions of Office applications as you like. Tables Table 9-1, Table 9-2, and Table 9-3 list switches for Microsoft applications Word, Excel, and PowerPoint, respectively.

Table 9-1. Switches for starting Word


What it does


Stops add-ins and global templates, including the Normal template, from being loaded automatically. It also locks Word's settings so that they cannot be read or modified.

 /l   addinpath   

Loads a specific Word add-in.


Starts a new instance of Word without running AutoExec macros.

 /m   filen   

Opens the file specified by number on the File menu's Most Recently Used list.

 /m   macroname   

Runs a specific macro and prevents Word from running any AutoExec macros.


Starts a new instance of Word without opening a document. Documents opened will not appear as choices in the Window menu of other Word instances.

 /t   templatename   

Starts Word with a new document based on the specified template.


Starts a new instance of Word with a blank document. Documents opened will not appear as choices in the Window menu of other Word instances.


Opens Word, reregisters it in the Registry, and then quits. Use this switch if there have been problems with Word's settings and you want to reregister it. At times, certain Registry keys associated with Word can get corrupted. If you use this switch, you'll delete the corrupt Registry keys and recreate them from scratch. Your problems should then go away.


Starts Word without the splash screen.

Table 9-2. Switches for starting Excel


What it does

 /r   workbook path/file name   

Opens the specified workbook as read-only.


Opens Excel without a startup screen and without a new blank workbook.


Opens Excel with a new workbook that contains a single macro sheet.

 /p   workbook path   

Opens Excel and uses the specified path as the active path instead of the default path


Opens Excel and then reregisters it in the Registry. Use this switch if there have been problems with Excel's settings and you want to reregister it.


Opens Excel, reregisters it, and then quits.


Opens Excel, unregisters it, and then quits.

Table 9-3. Switches for starting PowerPoint


What it does


Opens a presentation into the slide show window.


Prints the presentation.

/n template_name.pot .

Creates a new presentation based on the specified template.

9.5.3 See Also

  • [Hack #22]

Windows XP Hacks
Windows XP Hacks, Second Edition
ISBN: 0596009186
EAN: 2147483647
Year: 2005
Pages: 166

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net