Stop Windows 7 Explorer from automatically expanding folders

35

7

Windows 7 Explorer can be opened in any folder from the command line. But, it automatically expands (on the left nav panel) the Favorites, Desktop, and [Username] folders. This makes it hard to see what's what in the nav panel.

How can I tell Windows 7 Explorer to collapse those folders by default, until I open them? I only want the selected folder expanded.

SRobertJames

Posted 2010-11-10T18:10:41.903

Reputation: 351

I give up. Better just hide the left panel altogether, reconfigure the shortcut to %windir%\explorer.exe C:\Users\name\Links and add shortcuts there, or use the keyboard F4 + escape to type a directory if it's short or if you can paste it – Rivenfall – 2017-07-11T10:03:48.897

Update: It seems that Explorer remembers whatever folders were left expanded, and expands those each time. How do I have it start without expanding anything? – SRobertJames – 2010-11-10T18:44:37.550

Would love to see an answer to this. When browsing folders with explorer.exe, not everyone wants them to be automatically expanded in the treeview. And at other times, we might want folders to not unexpand automatically when we click another folder. – Robert Kerr – 2010-11-17T15:57:30.893

I would love to see a solution as well. My issue is this-I have a shortcut on my desktop to the root of my C: drive. I don't mind C: being expanded when I click on this link. What I do mind is that any folders on my desktop are expanded because I expanded them in a previous Explorer window and closed that window without collapsing the folder first. Windows "remembers" it was expanded in the other window so expands it when I click on my shortcut. I want Explorer to open with all folders collapsed (except for C:) when I click on the shortcut regardless of what happened in previous windows. – sdoca – 2011-11-03T20:43:53.673

2None of the answers are any good. The point isn't to make explorer not expand to the current folder, it's to make explorer show the current folder by not expanding a bunch of other default crap. Read the question folks. – Eli – 2014-04-11T18:42:47.850

Answers

38

There is a way to do this, at least for the user's home directory:

  • open explorer
  • right click on the username (the user's expanded home-directory)
  • do not choose any item of the context menu, but left click on the little arrow to collapse this directory
  • exit explorer
  • open explorer and enjoy ;)

anscheinbar

Posted 2010-11-10T18:10:41.903

Reputation: 481

9I can't believe this works, but thank you! – Mike Schall – 2014-08-29T14:44:36.853

3+1 Bizarre, but this worked for me too! Also can be used to prevent Libraries, Network, and Control Panel from auto-expanding (if, like me, you like to have Show All Folders enabled) – acatalept – 2015-05-15T16:55:43.137

2This actually works, crazy! – NateS – 2015-12-14T04:40:54.633

1Works on Windows 10! Don't you believe in magic yet? – Ivan Aksamentov - Drop – 2015-12-31T08:09:17.327

Clicking Expand/Collapse in the right-click menu also works. – bretddog – 2016-11-25T11:02:32.353

i dont see a collapse arrow . can you post a screen shot of this in your answer please? – Kalamalka Kid – 2017-03-04T05:55:26.647

To open the "Comupter" entry, use explorer.exe /E,::{20D04FE0-3AEA-1069-A2D8-08002B30309D} – Xan-Kun Clark-Davis – 2017-03-13T22:29:27.550

Windows magic :) – Broes De Cat – 2017-08-02T09:06:24.073

ZOMG! Can't believe this worked! – w-- – 2019-04-28T11:22:08.123

13

If, in the same "Folder Options" dialog (which is also accessible by going to "Organize -> Folder and Search Options", if you have not changed the default from hiding classic-style menus), you also uncheck "Show All Folders", it will no longer display and expand the current User Folder every time you open an Explorer window.

This had also been my biggest pain in the tush, and I just recently found the solution through Windows 7's built-in help (by doing the opposite of what they suggested).

Mr. Smith

Posted 2010-11-10T18:10:41.903

Reputation: 139

3

You might find this method helpful. Using Ctrl+Shift+E to expand to current folder.

Turn auto expand setting off in folder options. Now if you want to expand to the current folder use Ctrl+Shift+E This will expand navigation pane to the current folder.

see Navigate Windows Explorer More Quickly with These Keyboard Shortcuts

IMS Studio

Posted 2010-11-10T18:10:41.903

Reputation: 259

2

I found a working answer at Microsoft's web site, hopefully cross-linking URLs is allowed but if removed from this forum let me know and I will detail it out here. Proper credit to the true problem-resolvers is contained at the destination link.

There is a registry key that captures the state of the open/close state of the main folders in the left explorer Nav-Pane, which can be set within the explorer left frame, explorer closed to set the reg key, then the reg key value manually turned to read-only. Now when you occasionally open those folders like Favorites or your User ID (or more problematic is many program's File / Open dialog settings will reopen your User folder), after turning regkey read-only, when explorer or application file dialog is closed, the NavPane expanded folders regkey is not re-written, remaining at your preferred expanded/collapsed state.

The Explorer left NavPane state information is stored in the registry key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Modules\NavPane. If you delete the ExpandedState registry value, the next time you open Explorer it will show the "default" tree state.

A user also wrote a text batch file (so you can review each line of code to see what it does) to allow you to set explorer as desired, then turn the NavPane state read-only to preserve the state indefinitely. The batch script also allows you to reset the functionality to default windows (turn regkey read/write) and so on.

This is the link to Microsoft site with all details and script file:

http://social.technet.microsoft.com/Forums/windows/en-US/48ebc898-290d-405f-b4d5-c3dc72278b76/collapse-all-foldertrees-when-closing-explorer


As an add-on functionality to the above, I include this info because the comma/space syntax is different for Win7 versus WinXP / other versions that is widely documented on web sites. This sytnax will open explorer to your preferred folder, separate from which folders are expanded / collapsed with the answer provided for the direct question of this thread, but usually directly related to the intent of opening explorer to your specific requirements.

Here are command line paramaters to further open Explorer to a preferred directory in Win7 32-bit Home Premium. Create a shortcut with this command line as the Target: C:\Windows\explorer.exe explorer /e /root,"C:\" /select,"C:\PreferredDataDir"

Replace C:\PreferredDataDir with of course your preferred directory, including just a reference to the root of C:\ or root of another drive letter if preferred over a subdirectory. The root option specified still allows access to E: drive etc, unlike the published intended effect of the option to limit movement only within the root specified, which may work on other versions of Windows.

sdtechuser

Posted 2010-11-10T18:10:41.903

Reputation: 21

That would explain why it wouldn't work when I had no write rights to the registry! :-) – Xan-Kun Clark-Davis – 2017-05-20T21:51:02.887

1

Try this - open Windows Explorer. Click TOOLS > FOLDER OPTIONS

Uncheck Automatically Expand to Current Folder

What command line switches are you using (if any) while opening Explorer?

Sparx

Posted 2010-11-10T18:10:41.903

Reputation: 1 667

1

In Windows Explorer click on Tools > Folder Options

In the General tab under Navigation Pane Uncheck "Show all folders".

Now when you open Windows Explorer you should get collapsed folders.

whyvon

Posted 2010-11-10T18:10:41.903

Reputation: 21

1

Try turning network discovery off. At least this will keep the explorer from expanding out all of the network folders. An IT guy changed that setting on my computer, and it has plagued me for two years, until a few moments ago, as the machine expands out the network directories and prevents me from browsing to the path I want to explore.

guest

Posted 2010-11-10T18:10:41.903

Reputation: 11