Microsoft

Quick Tip: Control Windows Explorer with command line switches

Tailor Windows Explorer to fit your needs with command line switches.


Windows Explorer offers several command-line switches that can control the way it works. For example, by default, Windows Explorer opens the My Documents folder, but you can use a switch to have it open My Computer or any other folder instead. You can also direct Windows Explorer to select a specific folder or file when it opens and appear in either a multipane or single-pane view. Here's how.

Explorer switch definitions
The syntax for Windows Explorer is as follows:
EXPLORER.EXE [/n] [/e] [(,)/root,<object>] [/select,<sub object>]

Here are the command-line switches you can use to tailor Windows Explorer to fit your needs:
  • /n opens Windows Explorer in single-pane view, which is similar to the view you see when you open My Computer.
  • /e opens Windows Explorer in multipane view, which is the view used when you open it from the default Windows Explorer shortcut on the Start menu.
  • /root,<object> specifies the folder that you want Windows Explorer to use as the root for the view. For example, you might specify a UNC path to open Windows Explorer with the shared network folder as the root of the view.
  • /select,<sub object> opens Windows Explorer with the file, folder, or application specified by <sub object> selected.

Using Explorer switches
To edit the Windows Explorer command line, simply click Start | Programs | Accessories and then right-click Windows Explorer to open the Shortcut tab of the Windows Explorer Properties sheet shown in Figure A.

Figure A


Add the desired switches to the Target field and click OK when you're finished. The next time you click on the Windows Explorer icon, your new switches will take effect.

To make Windows Explorer open the My Computer folder when you click the Windows Explorer shortcut on the Start menu, change the value in the Target field to reflect the following:
%systemroot%\explorer.exe /e,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}

This example allows Windows Explorer to open in multipane view rooted on the UNC path "\\server\docs":
%systemroot%\explorer.exe /e,/root,\\server\docs

Share your command-line tips
Do you use command-line switches to make supporting your end users easier? Do you have a favorite command-line switch? Post a comment to this article and share your knowledge.

 

Editor's Picks

Free Newsletters, In your Inbox