File Explorer is the default file management application which comes bundled with every modern version of Windows. It allows the user to perform all basic file operations like copy, move, delete, rename and so on. It supports a number of command line arguments (switches) which can be useful in various scenarios. It's good to know them.
You can use File Explorer command line arguments in shortcuts, in batch files, in VB scripts or from PowerShell. In Windows 10, the application supports the following command line arguments.
Before you proceed: You can test these arguments by opening the Run box (Win + R) or a command prompt instance. There you can type the commands described below.
explorer.exe /n,folder_path
The switch "/n" makes File Explorer open a new window with the specified location selected in the navigation pane. If you omit the folder path, Windows 10 opens the Documents folder with This PC selected on the left or Quick Access. In very old Windows versions like XP, this switch made Explorer open a new window without the folder tree on the left. In Windows 10, 8, 7, it does not hide the left area.
explorer.exe /e,folder_path
The /e switch opens Windows Explorer expanded to the specified folder. In very old Windows versions like XP, this switch made Explorer open a new window with the folder tree on the left expanded to the specified folder. In Windows 10, it has exactly the same behavior as the "/n" switch mentioned above unless you enable the option "Expand to current folder".
explorer.exe /root,folder_path
Opens File Explorer with the specified folder as the root (topmost item in the breadcrumbs bar). For example, to open the folder "C:\apps\firefox beta", I need to execute the following command:
explorer.exe /root,"C:\apps\firefox beta"
When a folder is opened as root, Alt + Up no longer works to go up one level.
explorer.exe /select,file_or_folder_path
This switch tells File Explorer to open with the specified file or folder selected in file view (right pane). For example, to open the folder "C:\apps\firefox beta" with firefox.exe selected, I need to execute the following command:
explorer.exe /select,"C:\apps\firefox beta\firefox.exe"
The result will be as follows:
explorer.exe /separate
The explorer.exe application supports a secret hidden command line switch /separate. When specified, it forces Explorer to run in a separate process. This will open a new Explorer window directly in a separate process.
To check how many instances of Explorer you have running in a separate process, open Task Manager and go to the Details tab.
That's it. Feel free to leave a comment if you have a question or know more command line tricks with File Explorer.
Support us
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
Hi, thanks for that brilliant reference information!
Additional questions:
Can Windows-Explorer be forced to sort by “Date modified” (or other) when opend?
Can Windows-Explorer be forced to open in Detail-View?
That would be great?
Thanks a lot and kind regards
Rudi
These switches do not work if you are trying to open a folder on a different drive letter. If explorer is on the C: drive but you want to open a folder on the D: drive these switches do not work.
C:\Windows\explorer.exe /n,”D:\Drivers\network” – will not work
Nevermind, must have been some sort of typo because I got it to work
How do you open File Explorer with “This PC” selected?
Never mind. I finally discovered: Explorer.exe /n,
It’s important to include the comma with nothing after.
If you just specify /n it goes to Documents.
What Rudi said! Open in Details view and sorted by mod date!!
At least the Microsoft Deproductivity Department hasn’t prevailed in preventing the folder from remembering how you last set it — thus you only have to set in once, per folder. But as Rudi asks, I would like to “ensure” those settings as I invoke from the command line.
Is it just me, or is there not a single date on the page – on the article, the comments, the URL? Dates are often vitally significant for technical pages.
This concept confuses switches with arguments. Arguments are command line data ment to be accesses by the application being called, such as a script using the Arguments property to retrieve data from the command line needed by the script to accomplish a task particular to that script..
Switches will not accomplish this, File Explorer uses them to do a limited number of things about running the program. This information is never available to the app being run.
While the command line being run as cmd accepts actual arguments , the Windows Run input box will not. And that is part of the problem in need of a solution.
Thank you for posting.
I organize my access to folders is with a batch file for each folder. For example,
file01.bat contains: %SystemRoot%\explorer.exe /e, /select, “C:\Data\Folder1”
file02.bat contains: %SystemRoot%\explorer.exe /e, /select, “C:\Data\Folder2”
file03.bat contains: %SystemRoot%\explorer.exe /e, /select, “C:\Data\Folder3”
So, if I wanted to access Folder3, I would execute file03.bat.
Question: how do I update my batch script so that Explorer.exe doesn’t start a new instance of File Explorer?
I don’t think that it is possible.