Open the current folder in Explorer without the left side explorer bar:
Open any folder in Explorer without the left side explorer bar:
Open the current folder in Explorer with the left side explorer bar:
(Tip: Padmanabha Holla)
This trick with the comma also works for other folders:
The following tip by Peter Lancashire adds some interesting possibilities:
Windows XP adds even more switches for
EXPLORER.EXE, as explained in Microsoft KnowledgeBase article 314853:
|/N||Opens a new single-pane window for the default selection.
This is usually the root of the drive that Windows is installed on.
If the window is already open, a duplicate opens.
|/E||Opens Windows Explorer in its default view.|
|/ROOT,object||Opens a window view of the specified object.|
|/SELECT,object||Opens a window view with the specified folder, file, or program selected.|
As Peter said, the
/ROOT switch can be useful in shortcuts, to prevent Explorer from scanning the entire (slow) network.
Compare the result of the following command with the previous one:
And how about selecting a file or folder in the Explorer window:
/ROOT switch is ignored if the
/SELECT switch is used.
Using the explorer command will always open a new instance of the running Explorer (which is Windows' so called "primary shell").
This new instance will always use the primary shell's credentials, i.e. the logged on user's credentials.
To open an Explorer look-alike with other credentials, we can use Internet Explorer.
Open the current folder in an Explorer look-alike with the credentials of the session that runs this command:
IEXPLORE -E "%CD%"
Open the current folder with Administrator credentials:
RUNAS /User:%ComputerName%\Administrator "IEXPLORE -E \"%CD%\""
|Note:||Depending on the Internet Explorer version, the left side explorer bar may (IE6) or may not (IE7) be visible.|
This command won't work unless you add Internet Explorer's location to the PATH, or you use the fully qualified path to IEXPLORE.EXE in the command.
With a little help from
REG.EXE (code shown is for version 3.0) we can look up Internet Explorer's location on-the-fly:
@ECHO OFF SETLOCAL SET IEReg=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE FOR /F "tokens=3*" %%A IN ('REG Query "%IEReg%" /V ""') DO SET IExplore="%%~B" %IExplore% -E %1 ENDLOCAL
Or, if you insist on one-liners:
FOR /F "skip=1 tokens=3*" %%A IN ('REG Query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE" /V ""') DO "%%~B" -E %*
(note the addition of
Contrary to what I just wrote about a single Explorer process, it is possible to run Explorer as a separate process.
If you want to run each Explorer window in its own separate process, you need to tweak the registry:
REGEDIT4 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced] "SeparateProcess"=dword:00000001
By setting the value to 1, each Explorer window will run in a separate process.
This allows you to start an Explorer process with different credentials using the basic
RUNAS /User:%ComputerName%\Administrator "EXPLORER /E,\"Folder\""
It works, but I think there is a better solution.
Lately (I cannot find when this feature was introduced, it is available in Windows 7 64-bits), Explorer has a
/SEPARATE switch to specify which Explorer window we want to run in a separate process.
Start an Explorer window with Administrator's credentials:
RUNAS /User:%ComputerName%\Administrator "EXPLORER /SEPARATE"
Open Folder in an Explorer window with Administrator's credentials:
RUNAS /User:%ComputerName%\Administrator "EXPLORER /SEPARATE/E,\"Folder\""
Folder may be in
drive:\folder\subfolder or UNC format.
Mapped network drives, however, usually won't work because mappings are stored in the user profile.
More information can be found in Aaron Margosis' "Non-Admin" and App-Compat WebLog.
(Tip: Xavier del Peso Ribera)
page last modified: 2016-09-19