Control Windows Explorer with Command-Line Shortcuts
The normal path nomenclature
as shown in the "Windows Explorer Tutorial"
section will open general Windows Explorer folders when entered into the
Application Executable Filename & Path Textbox.
However, Microsoft provides command-line switches for opening and
manipulating instances of Windows Explorer, as shown below.
With these switches, specific locations with specific features
can be manipulated - for example, with the Folders bar in the left side on or
off.
For example, to open Windows Explorer to the C:\Power Tools Book\Hacks
subfolder only, with no folders above it, and using the Folders bar, I open the
command prompt and issue this command:
explorer /e,/root,c:\Power Tools Book\Hacks
When I do that, the view pictured in Figure 1 appears.

Figure 1. Opening Windows Explorer to a specific folder with
a specific view
Not only does the Explorer view
in Figure 1 open to a specific subfolder, but it also shows no folders above it.
The syntax for running Explorer from the command line with switches is:
explorer [/n] [/e] [,root,object] [[,/select],subobject]
Although switches aren't necessary; typing
explorer by itself launches the
default Explorer view.
Here is an explanation of how to use the switches and syntax:
/n - Opens Windows Explorer without displaying the Folders bar, the tree
structure of the hard drive. Instead, it launches the view shown in Figure 2.

Figure 2. The view of Explorer using the /n switch
/e - Opens Windows Explorer displaying the Folders bar.
/root, object - Opens Windows Explorer to a specific object, such as a folder,
without displaying the folders above it, as shown in Figure 1. Global Unique Identifiers
can also be used with this switch, as explained later in this section.
[[/select] ,subobject] -
Opens Windows Explorer to a specific file or folder that is then highlighted or
expanded. The subobject switch can be used only, without the /select parameter. When the
/select parameter is included, the
branches are not expanded, the folder is highlighted, and the subobject is
highlighted in the right pane.
Using Global Unique Identifiers (GUIDs) with Command-Line
Switches
|
To open Explorer to certain system folders—for
example, to My Network Places, do the following. Type
explorer in the
Application Executable Filename & Path Textbox
and follow it by a space, two colons, and the Global Unique Identifiers
(GUIDs) that identify specific system folders, like this:
explorer ::{208D2C60-3AEA-1069-A2D7-08002B30309D}
That command opens Windows Explorer to My Network
Places.
To incorporate the use of switches; similarly put a
space and two colons in front of the GUID, like this:
explorer /e, ::{208D2C60-3AEA-1069-A2D7-08002B30309D}
GUIDs can be used in desktop shortcuts, batch files,
and scripts, as well as at the command line. The table below lists
the GUIDs for various system folders.
|
Folder name |
GUID |
My Computer |
{20D04FE0-3AEA-1069-A2D8-08002B30309D}
|
My Network Places |
{208D2C60-3AEA-1069-A2D7-08002B30309D}
|
Network Connections |
{7007ACC7-3202-11D1-AAD2-00805FC1270E}
|
Printers and Faxes |
{2227A280-3AEA-1069-A2DE-08002B30309D}
|
Recycle Bin |
{645FF040-5081-101B-9F08-00AA002F954E}
|
Scheduled Tasks |
{D6277990-4C6A-11CF-8D87-00AA0060F5BF}
|
A very useful command line to open the Control Panel is as follows:
%systemroot%\system32\control.exe
where
%systemroot%
should be replaced by the specific computer's system path (i.e.
c:\windows).
|