Control Windows Explorer 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:


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