Command-line
switches modify the function of a command. For example, the switch
/ogn
when added to a
dir
command
sorts the directory
listing with directories first followed by files, all in alphanumeric
order. You can open a console prompt and type
dir
/ogn
to see how it
works. Another example is
Symantec’s
pcAnywhere, which
supports several switches that control the way pcAnywhere starts. The
/r
switch, for example, hides the
startup splash screen. Microsoft Word
supports several switches including /m
, which
prevents any
autoexec macros from executing. Many
other applications, including most Windows 2000 console commands,
also support command-line switches. You can incorporate these
switches in a few different ways depending on what you’re
trying to accomplish.
Tip
With most console commands you can execute the command followed by
the /?
switch to view a list of available switches
and other command parameters, as well as the command syntax. For some
Windows applications, executing the program with the
/?
switch opens the program’s Help file
focused on the page that references the program’s startup
switches.
Most likely you have a shortcut on the desktop, in a folder, or in the Start menu that points to an application with which you’d like to use command-line switches to modify the program’s startup. You can add command switches simply by modifying the shortcut’s target:
Right-click the shortcut and choose Properties.
Click in the Target text box and move the cursor to the end of the command line. The command is enclosed in quotes.
Outside of the last quote, add the desired switches.
Click OK to close the shortcut’s property sheet, and then test the application.
If you try to add the switches inside the quotes, Windows 2000 interprets the switches as part of the path and generates an error. The switches must be added outside the quotes.
If for some reason you don’t want to modify a shortcut or can’t apply the switches through a shortcut, you can instead use a .cmd file to execute the application with the desired switches. Here’s how:
Open Notepad.
Type the path and command you want to execute, such as:
C:\Program Files\Office2000\Winword.exe /m
Create a shortcut on the desktop, in a folder, or on the Start menu to the file you just created. Double-clicking the shortcut will execute the file, which executes the application contained in the file.
Get Windows 2000 Quick Fixes now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.