</head> <body> <h1>RegDelete</h1> <p>Deletes a subkey or value from the registry.</p> <h2 id="new">New Syntax <span class="ver">[v1.1.21+]</span></h2> <pre class="Syntax"><span class="func">RegDelete</span>, KeyName <span class="optional">, ValueName</span></pre> <h3 id="New_Parameters">Parâmetros</h3> <dl> <dt>KeyName</dt> <dd><p>The full name of the registry key.</p> <p>This must start with HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CURRENT_USER, HKEY_CLASSES_ROOT, or HKEY_CURRENT_CONFIG (or the abbreviations for each of these, such as HKLM). To access a <a href="LoopReg.htm#remote">remote registry</a>, prepend the computer name and a colon (or <span class="ver">[in v1.1.21+]</span> a slash), as in this example: <code>\\workstation01:HKEY_LOCAL_MACHINE</code></p></dd> <dt>ValueName</dt> <dd><p>The name of the value to delete. <strong>If omitted, the entire <em>KeyName</em> will be deleted</strong>. To delete <em>KeyName</em>'s default value -- which is the value displayed as "(Default)" by RegEdit -- use the phrase <code>AHK_DEFAULT</code> for this parameter.</p></dd> </dl> <h2 id="old">Old Syntax</h2> <p class="warning"><strong>Deprecated:</strong> This syntax is not recommended for use in new scripts. Use the <a href="#new">new syntax</a> instead.</p> <pre class="Syntax"><span class="func">RegDelete</span>, RootKey, SubKey <span class="optional">, ValueName</span></pre> <h3 id="Old_Parameters">Parâmetros</h3> <dl> <dt>RootKey</dt> <dd><p>Must be either HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CURRENT_USER, HKEY_CLASSES_ROOT, or HKEY_CURRENT_CONFIG (or the abbreviations for each of these, such as HKLM). To access a <a href="LoopReg.htm#remote">remote registry</a>, prepend the computer name and a colon (or <span class="ver">[in v1.1.21+]</span> a slash), as in this example: <code>\\workstation01:HKEY_LOCAL_MACHINE</code></p></dd> <dt>SubKey</dt> <dd><p>The name of the subkey (e.g. Software\SomeApplication).</p></dd> <dt>ValueName</dt> <dd><p>The name of the value to delete. <strong>If omitted, the entire <em>SubKey</em> will be deleted</strong>. To delete <em>SubKey</em>'s default value -- which is the value displayed as "(Default)" by RegEdit -- use the phrase <code>AHK_DEFAULT</code> for this parameter.</p></dd> </dl> <h2 id="Error_Handling">Error Handling</h2> <p><span class="ver">[v1.1.04+]</span>: This command is able to throw an exception on failure. For more information, see <a href="Catch.htm#RuntimeErrors">Runtime Errors</a>.</p> <p><a href="../misc/ErrorLevel.htm">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p> <p><a href="../Variables.htm#LastError">A_LastError</a> is set to the result of the operating system's GetLastError() function.</p> <h2 id="Remarks">Remarks</h2> <p class="warning"><strong>Warning</strong>: Deleting from the registry is potentially dangerous - please exercise caution!</p> <p>To retrieve and operate upon multiple registry keys or values, consider using a <a href="LoopReg.htm">registry-loop</a>.</p> <p>For details about how to access the registry of a remote computer, see the remarks in <a href="LoopReg.htm">registry-loop</a>.</p> <p>To delete entries from the 64-bit sections of the registry in a 32-bit script or vice versa, use <a href="SetRegView.htm">SetRegView</a>.</p> <h2 id="Related">Tópicos relacionados</h2> <p><a href="RegRead.htm">RegRead</a>, <a href="RegWrite.htm">RegWrite</a>, <a href="LoopReg.htm">Registry-loop</a>, <a href="SetRegView.htm">SetRegView</a>, <a href="IniDelete.htm">IniDelete</a></p> <h2 id="Examples">Exemplos</h2> <div class="ex" id="ExNewVsOld"> <p><a class="ex_number" href="#ExNewVsOld"></a> New syntax vs. old syntax.</p> <p>Despite the different syntax, both examples have the same effect; that is, they delete a value from the registry.</p> <pre>RegDelete, HKEY_LOCAL_MACHINE\Software\SomeApplication, TestValue</pre> <pre>RegDelete, HKEY_LOCAL_MACHINE, Software\SomeApplication, TestValue</pre> </div> </body> </html>