title: RegDelete cannot delete Registry key in WSH 5.7
body: <p>Based on the advice provided at <a href="http://www.tweakguides.com/VA_4.html" rel="nofollow noreferrer">http://www.tweakguides.com/VA_4.html</a> to prevent Windows Vista from "intelligently" rearranging column formats in Windows Explorer, I have written a script to automate the process a little.</p>
  
  <pre><code>Dim WshShell
  Set WshShell = WScript.CreateObject("WScript.Shell")
  
  
  'Remove the "filthy" reg keys first.
  regKey = "HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\BagMRU\"
  
  
  WScript.Echo "Deleting " &amp; regKey &amp; VbCrLf
  WshShell.RegDelete regKey
  
  regKey = "HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\"
  
  WScript.Echo "Deleting " &amp; regKey &amp; VbCrLf
  WshShell.RegDelete regKey
  
  
  'Then recreate a clean Bags key, with sub-keys and FolderType value.
  regKey = "HKCU\Software\Classes\Local Settings\Software\Microsoft\ Windows\Shell\Bags\AllFolders\Shell\FolderType"
  
  WScript.Echo "Creating " &amp; regKey &amp; " as 'NotSpecified' REG_SZ " &amp; VbCrLf
  WshShell.RegWrite regKey, "NotSpecified", "REG_SZ"
  
  WScript.Echo "Now define the columns of your preference in Windows Explorer," &amp; VbCrLf
  WScript.Echo "and click the Apply to Folders button in Folder Options." &amp; VbCrLf
  </code></pre>
  
  <p>But it is refusing to delete the registry key</p>
  
  <pre><code>E:\archive\settings\Windows Vista Explorer columns.vbs(9, 1) WshShell.RegDelete:
   Unable to remove registry key "HKCU\Software\Classes\Local Settings\Software\Mi
  crosoft\Windows\Shell\BagMRU\".
  </code></pre>
  
  <p>The suggestion is to put trailing "\" to indicate a key, which I did. Any ideas?</p>