RegDelete cannot delete registry key in WSH 5.7
Based on the recommendation given at http://www.tweakguides.com/VA_4.html , to prevent "smart" re-sorting of column formats in Windows Explorer Windows Vista, I wrote a script to automate the process a bit.
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 " & regKey & VbCrLf
WshShell.RegDelete regKey
regKey = "HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\"
WScript.Echo "Deleting " & regKey & 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 " & regKey & " as 'NotSpecified' REG_SZ " & VbCrLf
WshShell.RegWrite regKey, "NotSpecified", "REG_SZ"
WScript.Echo "Now define the columns of your preference in Windows Explorer," & VbCrLf
WScript.Echo "and click the Apply to Folders button in Folder Options." & VbCrLf
But he doesn't want to delete the registry key
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\".
The suggestion is to put a trailing "\" to indicate the key I did. Any ideas?
0
source to share
3 answers
break it to the end :)
Const HKCR=&H80000000:Const HKCU=&H80000001:Const HKLM=&H80000002:Const HKU=&H80000003:Const HKCC=&H80000005
dim pc,o,hive,key,name,value,i
pc="."
Set o=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & pc & "\root\default:StdRegProv")
hive=HKCU
key="Software\Microsoft\Windows\CurrentVersion\Explorer\Wallpapers\knownfolders\0\windows wallpapers\mergefolders"
regrid 5
sub regrid(levels)
dim a,n,j,base,s
a=split(key,"\")
n=ubound(a)
base="":for i=0 to levels-1:base=base & a(i) & "\":next
for i=n to levels step -1
s="":for j=levels to i:s=s & a(j) & "\":next
o.DeleteKey hive,base & s
next
end sub
Thank you all for your support in liberating education.
+1
source to share