LeightonJames Posted March 26, 2014 Posted March 26, 2014 I have got a vbscript that deletes registry keys from the local machine however some of the keys may/may not have sub keys. I have managed to code it so that if the key has a subkey it is deleted, however if it doesn't have a subkey the script fails. My code is ugly as sin and I'd rather not post it but I will if it is needed. Anyone got any ideas how I can accomplish this? cheers
sted Posted March 26, 2014 Posted March 26, 2014 if yor just want to remove a key and subkeys isnt it easier to create a reg file with a - next to the keyname and regedit/s regfile.reg (or use gpp)? so to remove a key [-HKEY_CLASSES_ROOT\Software\test]
ChrisH Posted March 26, 2014 Posted March 26, 2014 You need to check for the existence first before you run your deletion code. You would need to use on error resume next and check the error number for success. There are plenty of examples if you search for this kind of process.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now