Making Windows Explorer work as you wish!
If you have been accessing files on your Microsoft Windows 95, Windows 98, or Windows NT 4.0 based computer, you have no doubt done so using Windows Explorer. When using Windows Explorer, it typically opens to the default view displaying the contents of “C” drive. We are frequently ask how this can be changed to make it start with a different drive, or even start with no drives open at all. There are no special registry hacks, its all a matter of knowing which command line switches to use in the Windows Explorer short cut that is part of the Start Menu. The following will walk you through the common switches and why some work well and others not very well at all.
Windows Explorer’s Command Line Switches
The following chart shows the command line switches for Windows Explorer.
Windows Explorer Switches |
|
Command Line | Explorer [/n}] [/e] [,/root,object] [[,/select],subobject] |
Omitting both /n and /e | This will cause Windows Explorer to launch in a single-pane view. If there is already an instance of explorer open, it will duplicate the view of the first. Simply close the first one opened. |
/n | Causes Windows Explorer to launch in a single-pane open view. /n causes explorer to open a new window even if it duplicates an existing open window. Will override /e if both are present. |
/e | Launches Windows Explorer in two-pane window. Will open a new window even if it duplicates an existing open window. |
subobject | Specifies the drive or folder to be viewed upon opneing. |
/select, subobject | Specifies the file or folder that will be selected initially with its parent folder being opened. |
/root,object | Specifies the root of the Windows Explorer display. The user cannot navigate upward past the established root. By default, Desktop is the root. |
The switches shown above control the type of display Explorer will use, including the initial folder, selection and scope of the Explorer window opened. You can display the contents of a drive or folder in two different ways. If you right-click a folder and choose Open, you get a single-pane view, where each file or folder is represented by a large icon and a title. Explorer “recycles” windows of this type by default, which means that if the desired folder is present in an existing open view window, Explorer will activate that window rather than opening a new one.
If you right-click a folder and choose Explore, you get a two-pane view called the explore view, which is represented by a folder tree that appears in the left-hand pane, and the right-hand pane lists details about each file or folder, including the name, size, type, and last-modified date. If neither of the two switches are present, [/n] or [/e], Explorer uses the open view and recycles existing windows. The [/n] switch disables window recycling and forces a new open view window. The [/e] switch forces the explore view, whereupon Explorer does not recycle existing windows. If both the [/n] and [/e] switches are present, [/e] is ignored.
The [subobject] and [/select,subobject] switches control the initial Explorer display. When a folder name is added to the Explorer.exe command line to open that folder, you’re using the [subobject] switch. If you precede the full pathname of a file or folder with [/select], Explorer launches and highlights the specified file or folder with its parent opened. The command [explorer /e,/select,c:\windows\system] would cause explorer to open the c:\windows folder and highlight the system folder within it.
The [/root,object] switch is powerful not often used. The root folder is at the top of Explorer’s folder tree and has no parent as it shows the Desktop, by default. By using the [/root] switch, you can specify any drive or folder as the root for the Explorer display. As an example, you could create an Explorer window that displays only drive “C:”, with no direct access to virtual folders like Printers, Control Panel and the like.
This will give you a better understanding: Open an MS-DOS prompt, navigate to any folder and enter the command explorer /e,. (explorer, space, slash, e, comma, period.) Let’s understand what these entries mean.
- The “explorer” entry is the Windows Explorer program.
- The “space” let’s allows the program to distinguish that a command is coming.
- The “slash” precedes the actual command switch.
- The “e” or “n” are the actual switches. (see the chart above)
- The “comma” is a break between switches.
- The “period” ends the command line and represents the current folder so that you get a two-pane Explorer window showing that folder.
You can experiment with these switches right at the “command prompt” or “MS-DOS prompt”. When you find a combination you like, you can create a shortcut using that exact command, or you can insert it into an existing shortcut. Here are some switch combinations you may want to try:
Explorer /e,/select,c:\
This opens a two-pane Explorer view with none of the drives expanded. This is handy if you have multiple drives and use them all frequently.
Explorer /e,d:\
This opens a two-pane Explorer window that initially displays the contents of drive D:.
Explorer /e,/root,d:\data
This switch combination opens a two-pane window that initially displays the contents of the data folder on drive D:, and from which the user cannot navigate anywhere other than in or below that folder.
Explorer /e,/root,d:\,d:\data
This opens a two-pane window that initially displays the contents of the data folder on drive D:, and from which the user cannot navigate anywhere other than drive D:.
Creating a new shortcut:
To create a new shortcut using a particular command line, right-click the desktop and choose New, Shortcut from the popup menu. Enter the entire command line in the Create Shortcut dialog. If you have just tried the shortcut at an MS-DOS prompt, you can copy it from the prompt and paste it into the dialog. Click Next and give the shortcut a name such as Explorer rooted on D. Now click Finish. You will find the new shortcut on your desktop.
To move it to your Start menu, simply drag it and drop it onto the Start button. This puts the menu item in the main body of the Start menu, above the Programs menu. To move the item into the Programs menu, right-click the Start button and choose Explore. Windows Explorer will display the shortcuts and folders that define the Start menu; just drag the shortcut into the Programs folder or into one of its subfolders.
Changing a Desktop’s Shortcut Command Line:
To change a desktop shortcut’s command line, right-click the shortcut and choose Properties. The Target field on the Shortcut tab of the dialog is the command line you want. Now enter your new command line. If the shortcut you want to change is in the Start menu, right-click on the Start button and choose Explore from the pop-up menu. Now navigate to the menu folder that holds the shortcut you want, and modify it as described above.
When the switches don’t work as they should:
On some Windows configurations, the switch [/select,subobject] seems to fail. The subobject’s parent folder opens in the left pane and highlighted in the folder tree, but nothing is visibly highlighted in the list of files and folders. If you press the Tab key to move the focus to the detail list, you’ll see that the subobject is indeed selected.
The Microsoft Knowledge Base documents several instances where the various switches do not work.
Article Q208114, “Windows Explorer /N Switch Does Not Open a New Window“, the command Explorer [/n] fails to disable window recycling under Windows 98 and Windows 98 SE. Microsoft recommends using the [/e] switch instead.
Article Q237494, “The Explorer Command Does Not Select the Correct File“, states that in Windows 98 SE, the [/select] switch without [/n] or [/e] may not select the correct file if the folder that contains it is already open. Microsoft does not offer a workaround for this problem. For some unknown reason these vagaries do not effect all Windows 9x based systems.