Jump to content

Deleting all subkeys of a parent key in a registry using winapp2.ini for CCleaner


tushar321

Recommended Posts

 I want to delete subkeys under 'Certificates' parent key

every new subkeys under 'Certificates' parent key are generated with a long string of numbers which cannot be predicted in advance and so difficult to write in a command using their names.

 

So, I am looking a command or wild character type thing to delete all subkeys coming under 'Certificates' parent key without knowing their names

 

Untitled.jpg.3979fde99c585947eaad408937984136.jpg

 

I am able to delete one key, for example, 'Certificates' using winapp.ini in CCleaner by including the following command :

 

-------------------------------------------------------------------------------------------------------------------------

[RemainOfApp]

LangSecRef=3024

Detect=HKLM\SOFTWARE\Microsoft\SystemCertificates\SPC\Certificates

Default=True

RegKey1=HKLM\SOFTWARE\Microsoft\SystemCertificates\SPC\Certificate

-------------------------------------------------------------------------------------------------------------------------

 

but the problem is this allows to delete one key (which is parented-key for my requirement) not its all subkeys without knowing their names.

 

I tried using * or *.* wild character

 

HKLM\SOFTWARE\Microsoft\SystemCertificates\SPC\Certificate\*

HKLM\SOFTWARE\Microsoft\SystemCertificates\SPC\Certificate\*.*

 

but not working

I am also thinking even after getting correct command for deleting all subkeys without knowing their names, I may get an error 'admin privilege required for deleting these subkeys'

 

Please suggest me any solution.

 

Link to comment
Share on other sites

so for this situation, what is the solution.

or I can write few commands in .bat or .cmd file and then trigger this file to run from my CCleaner while registry clears up entries.

or write directly any specific command in winapp.ini which will be used by CCleaner.

so I need that syntax command.

Link to comment
Share on other sites

  • Moderators

Via a .bat, .cmd, or even a .reg file I personally don't know how to have a wildcard work on removing registry data. What I've did in the past is export registry settings, and then modify it to first delete the whole key, and then restore only what I want in it - effectively getting around the limitation.

Example (using one .reg file to remove settings, and restore settings), lets assume SomeApp in the example below has 25 settings, but you only want to keep the first 4 settings which wild card deletion won't work on:
 

Windows Registry Editor Version 5.00

; This removes SomeApp's settings

[-HKEY_LOCAL_MACHINE\SOFTWARE\SomeApp\Settings]


Windows Registry Editor Version 5.00

; This restores SomeApps's settings

[HKEY_LOCAL_MACHINE\SOFTWARE\SomeApp\Settings]
"SomeAppSettings1"=dword:00000000
"SomeAppSettings2"=dword:00000001
"SomeAppSettings3"=dword:00000002
"SomeAppSettings4"=dword:00000003

 

Link to comment
Share on other sites

Yes, Andavari your ides is very good and it didn't come to my mind.

I can achieve my goal by running.reg file by adding the following two entries :

------------------------------------------------------------------------------------------------------------------------------------------

Windows Registry Editor Version 5.00
 
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SystemCertificates\SPC\Certificates]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SystemCertificates\SPC\Certificates]

------------------------------------------------------------------------------------------------------------------------------------------

The first will delete the 'Certificates' Key which in result will also delete all its sub-keys (as I want to delete these all sub-keys who's names are unpredictable)

then the second line will again create 'Certificates' key which I want to persist there.

I am running this .reg file through .bat file in order to supress conformation dialogs :

certiBat.bat

---------------------------------------------------------------------------------------
regedit.exe /S D:\Desktop\createCerti.reg
---------------------------------------------------------------------------------------

 

Is there any way to run or trigger to run this .bat file from CCleaner ?

like if I can add a path of this .bat file in .ini file or somewhere from where I can get an option to trigger this file to run form CCleaner GUI interface.

Link to comment
Share on other sites

  • Moderators

As for getting CCleaner to run the .bat file I don't think it can but don't quote me on that - it's outside of the scope in which I use it.

As for getting your own personal cleaner to run automatically don't forget about Task Scheduler in Windows, that would save you from having to remember to mess with it.

Link to comment
Share on other sites

The reason I am not associating this .bat file to run from task scheduler as this task is not pre-determined when to run and so has to be performed manually on uninstall of certain software so at that time I generally clear registry entries from CCleaner so I was just thinking to perform this task along with that simultaneously but anyway I think this is not possible.

I observe that using .ini following command I am able to achieve partial thing what I want  : 

-------------------------------------------------------------------------------------------------------------------------

[MyAppName]

LangSecRef=3024

Detect=HKLM\SOFTWARE\Microsoft\SystemCertificates\SPC\Certificates

Default=True

RegKey1=HKLM\SOFTWARE\Microsoft\SystemCertificates\SPC\Certificate

-------------------------------------------------------------------------------------------------------------------------

Adding above command in .ini file will delete 'Certificate' registery key this is shown in CCleaner with an identifier name 'MyAppName' as shown in image :

 

Untitled1.thumb.png.802d223536c953095672d53dc13a6dbe.png

But I think there is no way to delete only subkeys inside 'Certificates', not the 'Certificates'  key itself.

Untitle6.jpg.9948da470878e96750b893166c17875b.jpg

why I am not able to mention subkeys name as names are unpredictable long string of number and alphabetic which are created every time when I install new software

I saw CCleaner has given an option to delete subfolders without knowing their name and number of folders by using :

----------------------------------------------------------------------------------------------------------------------------------------------------------------

·        *.* - deletes every file in that folder. Example: %ProgramFiles%\Yahoo!\Messenger\Profiles|*.*

·        RECURSE - deletes subfolders and their contents. Example: "%ProgramFiles%\Yahoo!\Messenger\Profiles|*.*|RECURSE" (The "Profiles" folder contents will be deleted, but the  folder itself will not)

----------------------------------------------------------------------------------------------------------------------------------------------------------------

 

I saw the following page, but I think this type of provision is not available in CCleaner with regards to Detect and Deleting Sub-keys in a registry. It is only available with files and folders, but not for the registry.

How to add your own program for CCleaner to clean

I how CCleaner team will soon add a similar provision for registry also.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.