{"id":2954,"date":"2021-11-01T11:49:28","date_gmt":"2021-11-01T11:49:28","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=2954"},"modified":"2021-11-01T11:49:53","modified_gmt":"2021-11-01T11:49:53","slug":"if-reg-key-exists-then-delete-it-with-batch","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/if-reg-key-exists-then-delete-it-with-batch\/21382.html","title":{"rendered":"If Reg Key Exists Then Delete It With Batch?"},"content":{"rendered":"<p>Is it possible to delete a registry key only if it exists with a batch file?<\/p>\n<p>For example, I would like to completely delete the following registry keys &#8216;KeyName&#8217; without confirmation.<\/p>\n<p>REG DELETE &#8220;HKCU\\Software\\CompanyName\\ProductName\\KeyName&#8221; \/F<br \/>\nREG DELETE &#8220;HKLM\\SOFTWARE\\CompanyName\\ProductName\\KeyName&#8221; \/F<br \/>\nREG DELETE &#8220;HKCU\\Software\\Wow6432Node\\CompanyName\\ProductName\\KeyName&#8221; \/F<br \/>\nREG DELETE &#8220;HKLM\\SOFTWARE\\Wow6432Node\\CompanyName\\ProductName\\KeyName&#8221; \/F<\/p>\n<p>The above works in simply deleting the keys.<br \/>\nIs it possible to attempt such deleting only if each key exists? Also, if the key exists is deleted is it possible to echo a success message for that key?<\/p>\n<p>Basically, I would like a batch to only delete a key if it exists without confirmation then echo a success message for that deleted key.<\/p>\n<p>Thanks in advance for any help.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":21},"question-category":[55],"question_tags":[],"class_list":["post-2954","question","type-question","status-publish","hentry","question-category-programming"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question\/2954","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=2954"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=2954"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=2954"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=2954"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}