RegDelEmptyParentKeys - Clean up a Windows registry file from redundant empty keys

Help with writing and running scripts

RegDelEmptyParentKeys - Clean up a Windows registry file from redundant empty keys

Postby amr_ali » Mon Jan 28, 2013 6:57 am

The purpose of this script is to clean up a Windows registry file from the redundant empty keys while preserving
the child keys. This may be useful for example when you want to compare two registry files side by side.


This is an example of a Windows registry file:

Code: Select all

[HKEY_CURRENT_USER\System\CurrentControlSet\Control]

[HKEY_CURRENT_USER\System\CurrentControlSet\Control\MediaProperties]

[HKEY_CURRENT_USER\System\CurrentControlSet\Control\MediaProperties\PrivateProperties]

[HKEY_CURRENT_USER\System\CurrentControlSet\Control\Network]

[HKEY_CURRENT_USER\System\CurrentControlSet\Control\Network\NetworkLocationWizard]
"ShowCount"=dword:00000018



The registry file after executing the script:

Code: Select all

[HKEY_CURRENT_USER\System\CurrentControlSet\Control\MediaProperties\PrivateProperties]

[HKEY_CURRENT_USER\System\CurrentControlSet\Control\Network\NetworkLocationWizard]
"ShowCount"=dword:00000018



RegDelEmptyParentKeys.zip
script version 1
(1.82 KiB) Downloaded 96 times

Note
Please make sure that the registry file is sorted first before executing the script.

If the registry file is not sorted, you can sort it with this script: RegIniFileSort
amr_ali
Newbie
 
Posts: 4
Joined: Sat Nov 10, 2012 12:15 pm

Return to Scripts