Delete registry key

(imported topic written by cstoneba)

I’m trying to write some lines that will delete a key with the following names:

  1. [-HKEY_CLASSES_ROOT\CLSID{238F* (Starts with {238F )

appendfile {("%0d%0a") of (names of (keys whose (exists keys “{238F” of it) of key “HKEY_CLASSES_ROOT\CLSID” of registry))}

  1. each user’s registry hive under \SOFTWARE\Citrix on the workstation. Delete the following keys:

ICA Client

PrinterProperties

PNAgent

Program Neighborhood Agent

Much appreciated.

(imported comment written by BenKus)

Is this what you want:

delete __appendfile
delete temp.reg
appendfile REGEDIT4
appendfile {("%0d%0a") of (names whose (it starts with “{238F”) of keys of key “HKEY_CLASSES_ROOT\CLSID” of registry) }
move __appendfile temp.reg
waithidden regedit -s temp.reg

Note that this expression took a really long time on my computer (30 seconds) and I am not sure why…

  1. You can try this approach:

delete __appendfile
delete temp.reg
appendfile REGEDIT4
appendfile {("%0d%0a") of (“HKEY_USERS” & item 0 of it & “\SOFTWARE\Citrix” & item 1 of it ) of (names of keys of key “HKEY_USERS” of registry, (“ICA Client”;“PrinterProperties”;“PNAgent”;“Program Neighborhood Agent”))}
move __appendfile temp.reg
waithidden regedit -s temp.reg

This will list the keys even if they don’t exist, but I don’t think that will be an issue…

I would make sure to test this extensively…

Ben

(imported comment written by cstoneba)

Is that the correct code for #1 (Starting with {238F )? That was one of the questions I was asking. Sorry for the confusion.

(imported comment written by cstoneba)

Can anyone confirm that this is the append command to delete a key in HKEY_CLASSES_ROOT\CLSID that starts with {238F ?

appendfile {("%0d%0a") of (names whose (it starts with “{238F”) of keys of key “HKEY_CLASSES_ROOT\CLSID” of registry) }

thanks

(imported comment written by BenKus)

Hi cstoneba,

I think it should work as you suggested… it will delete the key “238F” in any key that starts with “{238F” in the HKCR\CLSID key.

Please try to execute this relevance in QnA and make sure it gives you want…

Ben