Apps Collapse All or Specific Keys in Registry Editor Tree in Windows 11

  • Thread starter Thread starter Brink
  • Start date Published: Start date Updated Updated:
  • Tags Tags
    regedit

Registry_Editor_banner.webp

This tutorial will show you different ways to collapse and close all or specific registry keys and branches in the Registry Editor (regedit) tree in Windows 10 and Windows 11.

System configuration information is stored centrally in a hierarchical database called the registry. You can use Registry Editor to add and edit registry keys and values, restore the registry from a backup or to default values, and to import or export keys for reference or backup.

If you use the Find and Find Next feature in Registry Editor to search for keys, values, and data, it can expand (open) several keys and branches on the tree for you to collapse (close) afterwards if wanted.



Contents

  • Option One: Close and Collapse All Keys at Once in Registry Editor
  • Option Two: Close and Collapse All Keys Except Last Key at Once in Registry Editor
  • Option Three: Collapse Specific Keys in Registry Editor using Context Menu
  • Option Four: Collapse Specific Keys in Registry Editor using Caret on Tree Menu
  • Option Five: Collapse Specific Keys in Registry Editor using Left Arrow Key


EXAMPLE: Registry Editor with all keys closed and all branches collapsed in tree

Registry_Editor.webp





Option One

Close and Collapse All Keys at Once in Registry Editor


1 Perform either action below in Registry Editor:
  • Press the Home key.
  • Click/tap on Computer in the left pane.
2 Perform either action below in Registry Editor:
  • Press the Alt + F4 keys.
  • Close (X) Registry Editor.
3 The next time you open Registry Editor (regedit), it will open with all keys closed and collapsed.




Option Two

Close and Collapse All Keys Except Last Key at Once in Registry Editor


1 Perform either action below in Registry Editor:
  • Press the Alt + F4 keys.
  • Close (X) Registry Editor.
2 The next time you open Registry Editor (regedit), it will open with all keys closed and collapsed except the last key opened when Registry Editor was closed.




Option Three

Collapse Specific Keys in Registry Editor using Context Menu


1 Right click on an expanded key or branch you want to collapse in the left pane of Registry Editor. (see screenshot below)

2 Click/tap on Collapse to collapse the current key or branch.

Collapsing a branch or key will not close subkeys.


regedit_Collapse_context_menu.webp





Option Four

Collapse Specific Keys in Registry Editor using Caret on Tree Menu


1 Click/tap on the caret (v) for an expanded key or branch you want to collapse in the left pane of Registry Editor. (see screenshot below)

Collapsing a branch or key will not close subkeys.


regedit_Collapse_caret.webp





Option Five

Collapse Specific Keys in Registry Editor using Left Arrow Key


1 Select an expanded key or branch you want to collapse in the left pane of Registry Editor.

2 Press the Left Arrow key to collapse the current key or branch.

Collapsing a branch or key will not close subkeys.



That's it,
Shawn Brink


 
Last edited:
Spiffing.
All those methods also work in Windows 10.


Denis
 

My Computer My Computer

At a glance

Windows 11 Home x64 Version 25H2 Build 26200....
OS
Windows 11 Home x64 Version 25H2 Build 26200.8037
if you want a ps1 to open it with all trees collapsed:

Code:
$regPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit"
Remove-ItemProperty -Path $regPath -Name "LastKey" -ErrorAction SilentlyContinue
Start-Process regedit.exe

if you want it to open a new instance with all trees collapsed:

Code:
$regPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit"
Remove-ItemProperty -Path $regPath -Name "LastKey" -ErrorAction SilentlyContinue
Start-Process regedit.exe /m

if you want a scheduled task to run a powershell command every 10 minutes to remove the LastKey entry (thus, making regedit open fully collapsed), run this in elevated powershell (you can edit the time of the task in task scheduler once created, if desired) *this will flash a PS console when it runs, but if you want it invisible, use conhost.exe or invisible.vbs to run the command instead*:

Code:
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -WindowStyle Hidden -Command `"Remove-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit' -Name 'LastKey' -ErrorAction SilentlyContinue`""

$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) `
    -RepetitionInterval (New-TimeSpan -Minutes 10) `
    -RepetitionDuration (New-TimeSpan -Days 30)

Register-ScheduledTask -TaskName "ClearRegeditLastKey" -Action $action -Trigger $trigger -Description "Clears Regedit LastKey every 10 minutes"

AHK to open Regedit in New Instance with all Trees Collapsed (compiled .exe is attached for this AHK - *may need excluded from Defender*):
Code:
RegDelete, HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit, LastKey

Run, regedit.exe /m
 

Attachments

Last edited:

My Computer My Computer

At a glance

Windows 11 Pro
OS
Windows 11 Pro

Latest Support Threads

Back
Top Bottom