『楼 主』:
[转贴][VBS]重置Vista所有文件夹显示风格
原帖地址:
http://www.visualbasicscript.com/m_44321/tm.htm
Vista用久了,文件夹显示就及其混乱,比如说详细信息的作者、专辑、#等。这个VBS可以把所有文件夹显示风格设置为初始状态。
'==========================================================================
'
' SCRIPT NAME: ClearAllFoldersColumnSettings.vbs
'
' AUTHOR: DiGiTAL.SkReAM
' DATE : 3/10/2007
'
' COMMENT: This script will erase the registry key which contains the folder customization settings
' for the current user. This will force all folder customization settings for the current
' user to be set back to the defaults.
'==========================================================================
Option Explicit
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_USERS = &H80000003
Dim oShell, oFSO, oEnv, oNet, sSubKey, aSubKeys, s
Set oShell = CreateObject("Wscript.Shell")
GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv").EnumKey _
HKEY_CURRENT_USER, "Software\Microsoft\Internet Explorer\InternetRegistry\REGISTRY\USER", aSubKeys
For Each sSubKey In aSubKeys
fKillRegKey "HKEY_USERS\" & sSubkey & "_Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags"
Next
Function fKillRegKey(ByVal sKeyToDelete)
Dim aSubKeys, sSubKey, iSubkeyCheck, sKeyToKill, iElement
Dim aKeyPathSubSection, hKeyRoot, oWMIReg, strKeyRoot
aKeyPathSubSection = Split(sKeyToDelete, "\")
hKeyRoot = HKEY_USERS
strKeyRoot = "HKEY_USERS"
For iElement = 1 To UBound(aKeyPathSubSection)
sKeyToKill = sKeyToKill & "\" & aKeyPathSubSection(iElement)
Next
If Left(sKeyToKill,1) = "\" Then sKeyToKill = Right(sKeyToKill, Len(sKeyToKill)-1)
'Errors will be generated when there are no subkeys during recursion - this is normal and expected
On Error Resume Next
Set oWMIReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
iSubkeyCheck = oWMIReg.EnumKey(hKeyRoot, sKeyToKill, aSubKeys)
If iSubkeyCheck = 0 And IsArray(aSubKeys) Then
For Each sSubKey In aSubKeys
If Err.Number <> 0 Then
Err.Clear
Exit Function
End If
'Recursively call this function, to delete each subkey - and their subkeys, and so on...
fKillRegKey strKeyRoot & "\" & sKeyToKill & "\" & sSubKey
Next
End If
'if the key has no subkeys, delete it.
oShell.RegDelete strKeyRoot & "\" & sKeyToKill & "\"
End Function [ Last edited by estar on 2007-3-26 at 03:52 AM ]
|