记事本
打开记事本。这个不多说。
复制以下代码:'********************************************************************'*'* Name: CSI_Reset_IE_32-bit_Shortcuts.vbs'* Author: Darwin Sanoy'* Updates: http://csi-windows.com/toolkit'* Bug Reports &' Enhancement Req: http://csi-windows.com/contactus'*'* COPYRIGHT NOTICE: This script is Copyrighted by Synaptic Fireworks, LLC'*'* Built/Tested On: Windows 7 x64'*'* Main Function:'* Sometimes a well meaning individual replaces the standard 32-bit IE'* shortcuts with 64-bit IE shortcuts, which creates a lot of problems.'* This script sets desktop and start menu shortcuts back to 32-bit'* and deletes the default 64-bit IE shortcut.'* If the default shortcuts are completely missing, they will be recreated.'* Syntax:'* CSI_Reset_IE_32-bit_Shortcuts.vbs'*'* DEL_DEFAULT_IE64_SHORTCUT = True - will delete the default 64-bit shortcut'* so that users do not use it or even know it is available.'* REPIN_IE = True - will re-do the pinning of the shortcut'* Limitations:'* IE 32-bit is identified as the default for many things in the registry'* (e.g. opening .HTM files) This script does not handle any re-configuration '* of IE defaults in the registry. Const SCRIPTVERSION = 2.0'*'* Revision History:'* 07/31/12 - 2.0 - Can handles all users and Default user'* - corrected RE-PIN routine to work off startmenu shortcut'* - ensure proper bitness IE is always used'* - do nothing on 32-bit Windows OS'* 03/02/12 - 1.1 - inital version (djs)'*'*******************************************************************'Customize these constants to control how the script behavesConst DO_ALL_USERS_AND_DEFAULT_USER = True 'If false - do only current userConst DEL_DEFAULT_IE64_SHORTCUT = True 'delete the default IE 64bit shortcutConst REPIN_IE = True 'unpin and repin in case someone pinned the 64-bit lnkConst IE_DESKTOP_SHORTCUT = True 'create the Desktop shortcut (existing one will always be deleted)bDebugMessagesOn = FalseConst CSIDL_STARTMENU = &H0b Const CSIDL_DESKTOPDIRECTORY = &H10 Const CSIDL_PROGRAMS = &H02 Const CSIDL_PROGRAMFILESX86 = &H2Aset oFSO = CreateObject('Scripting.FileSystemObject')Set Shell = CreateObject('WScript.Shell')Set objShlApp = CreateObject('Shell.Application')' If accidentally run on 32-bit Windows, silently quitIf GetObject('winmgmts:root\cimv2:Win32_Processor='cpu0'').AddressWidth = 32 Then wsh.quitWinVer = Shell.RegRead('HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentVersion')'This fix is only valid for Vista and Windows 7. 'Windows 8 always launches a 64-bit instance for the UI, but launches 32-bit 'processes to host individual websites - so the bitness of IE no longer relies'on which EXE or shortcut is executedIf NOT (WinVer > 5 AND WinVer < 6.2) Then wsh.quitDesktopPath = objShlApp.NameSpace(CSIDL_DESKTOPDIRECTORY).Self.PathDebugMessage 'Desktop Path: ' & DesktopPathStartmenuPath = objShlApp.NameSpace(CSIDL_PROGRAMS).Self.PathDebugMessage 'Start Menu Path: ' & StartmenuPathProgramFilesX86 = objShlApp.NameSpace(CSIDL_PROGRAMFILESX86).Self.PathDebugMessage 'ProgramFilesX86 Path: ' & ProgramFilesX86If DO_ALL_USERS_AND_DEFAULT_USER Then 'Do all users and the Default User 'Must have admin to access shortcuts in other profiles If NOT CSI_IsAdmin() Then wsh.echo 'Must run with admin rights to process all users, aborting...' wsh.quit End If Const WMI_HKCR = &H80000000 Const WMI_HKCU = &H80000001 Const WMI_HKLM = &H80000002 Const WMI_HKU = &H80000003 Set oWMI = GetObject('winmgmts:\\.\root\default') set oReg = oWMI.Get('StdRegProv') oReg.GetExpandedStringValue WMI_HKLM,'SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList','ProfilesDirectory',ProfilePath oReg.GetExpandedStringValue WMI_HKLM,'SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList','Default',DefaultProfileFolder aRegSIDS = GetRegularUserSIDs UserMessage 'Number of Regular User SIDs: ' & ubound(aRegSIDS) + 1 UserMessage 'List of Regular User SIDs: ' & join(aRegSIDS,',') 'Update each user who has logged in at least once For Each rSID in aRegSIDs CurrentProfilePath = GetUserIDorSIDInfo(rSID,'ProfileFolder') CurrentDesktopPath = CurrentProfilePath & '\Desktop' CurrentStartmenuPath = CurrentProfilePath & '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs' UserMessage GetUserIDorSIDInfo(rSID,'UserID') & ' (' & rSID & ') folders:' UserMessage 'Profile: ' & CurrentProfilePath UserMessage 'Desktop: ' & CurrentDesktopPath UserMessage 'Start Menu: ' & CurrentStartmenuPath UnpinIE(CurrentStartmenuPath) RebuildStartmenuShortcut(CurrentStartmenuPath) RebuildDesktopShortcut(CurrentDesktopPath) if DEL_DEFAULT_IE64_SHORTCUT then Remove64bitIEShortcut(CurrentStartmenuPath) If REPIN_IE Then RePinIE(CurrentStartmenuPath) Next 'Update default profile CurrentDesktopPath = DefaultProfileFolder & '\Desktop' CurrentStartmenuPath = DefaultProfileFolder & '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs' UserMessage 'Profile: ' & DefaultProfileFolder UserMessage 'Desktop: ' & CurrentDesktopPath UserMessage 'Start Menu: ' & CurrentStartmenuPath UnpinIE(CurrentStartmenuPath) RebuildStartmenuShortcut(CurrentStartmenuPath) RebuildDesktopShortcut(CurrentDesktopPath) if DEL_DEFAULT_IE64_SHORTCUT then Remove64bitIEShortcut(CurrentStartmenuPath) If REPIN_IE Then RePinIE(CurrentStartmenuPath)Else 'Do Just the Current User UnpinIE(StartmenuPath) RebuildStartmenuShortcut(StartmenuPath) RebuildDesktopShortcut(DesktopPath) if DEL_DEFAULT_IE64_SHORTCUT then Remove64bitIEShortcut(StartmenuPath) If REPIN_IE Then RePinIE(StartmenuPath)End IfFunction UnpinIE (UnPinPath) 'UnPin IE If oFSO.FileExists(UnPinPath & '\Internet Explorer.lnk') Then On Error Resume Next Set objFolder = objShlApp.Namespace(UnPinPath) Set objFolderItem = objFolder.ParseName('Internet Explorer.lnk') Set colVerbs = objFolderItem.Verbs For Each objVerb in colVerbs If Replace(objVerb.name, '&', '') = 'Unpin from Taskbar' Then objVerb.DoIt End If Next On Error Goto 0 End IfEnd FunctionFunction RebuildStartmenuShortcut(StartmenuSCPath) 'Delete Startmenu Shortcut if oFSO.FileExists(StartmenuSCPath & '\Internet Explorer.lnk') Then oFSO.DeleteFile(StartmenuSCPath & '\Internet Explorer.lnk') Set link = Shell.CreateShortcut(StartmenuSCPath & '\Internet Explorer.lnk') link.Description = 'Internet Explorer' link.TargetPath = ProgramFilesX86 & '\Internet Explorer\iexplore.exe' link.WindowStyle = 3 link.WorkingDirectory = '%HOMEDRIVE%%HOMEPATH%' link.SaveEnd FunctionFunction RebuildDesktopShortcut(DesktopSCPath) 'Delete Desktop Shortcut if oFSO.FileExists(DesktopSCPath & '\Internet Explorer.lnk') Then oFSO.DeleteFile(DesktopSCPath & '\Internet Explorer.lnk') 'Create 32-bit Desktop Shortcut if desired If IE_DESKTOP_SHORTCUT Then Set link = Shell.CreateShortcut(DesktopSCPath & '\Internet Explorer.lnk') link.Description = 'Internet Explorer' link.TargetPath = ProgramFilesX86 & '\Internet Explorer\iexplore.exe' link.WindowStyle = 3 link.WorkingDirectory = '%HOMEDRIVE%%HOMEPATH%' link.Save End IfEnd FunctionFunction Remove64bitIEShortcut(IE64bitSCPath) 'Delete 64-bit Shortcut in Start Menu If oFSO.FileExists(IE64bitSCPath & '\Internet Explorer (64-bit).lnk') Then oFSO.DeleteFile(IE64bitSCPath & '\Internet Explorer (64-bit).lnk')End FunctionFunction RePinIE(RePinPath) 'Pin IE to Taskbar If oFSO.FileExists(RePinPath & '\Internet Explorer.lnk') Then 'On Error Resume Next Set objFolder = objShlApp.Namespace(RePinPath) Set objFolderItem = objFolder.ParseName('Internet Explorer.lnk') Set colVerbs = objFolderItem.Verbs For Each objVerb in colVerbs If Replace(objVerb.name, '&', '') = 'Pin to Taskbar' Then objVerb.DoIt End If Next On Error Goto 0 End IfEnd FunctionFunction GetRegularUserSIDs () 'althought WMI methods exist for this type of retrieval, using this regkey ' guarantees: *) These are not groups, *) They have logged in once and ' created an NTUSER.DAT (can't have UAC Virt if user id never logged in) set oFSO = CreateObject('Scripting.FileSystemObject') oReg.EnumKey WMI_HKLM, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList', arrSIDList For Each SID In arrSIDList DebugMessage 'Checking: ' & SID oReg.GetExpandedStringValue WMI_HKLM,'SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\' & SID,'ProfileImagePath',ProfilePath sidparts = split(SID,'-') if ubound(sidparts) = 7 Then If sidparts(3) = '21' and Cint(left(sidparts(7),4)) >= 1000 Then FixedSID = CleanExtension(SID) DebugMessage ' =>Is a REGULAR User SID' DebugMessage 'Checking for: ' & ProfilePath & '\Local Settings\Application Data\Microsoft\Windows\Usrclass.dat' If oFSO.FileExists(ProfilePath & '\Local Settings\Application Data\Microsoft\Windows\Usrclass.dat') Then DebugMessage ' =>Adding to List because SID has a Usrclass.DAT' GetRegularUserSIDS = GetRegularUserSIDS & FixedSID & ',' End If Else DebugMessage ' =>Not regular user sid (incorrect format)' 'DebugMessage 'Hive Loaded?: ' & IsUserRegHiveLoaded(FixedSID) 'DebugMessage 'Virtualized Key List: ' & GetUACVirtRegKeys(SID,'') End If Else DebugMessage ' =>Not regular user sid (incorrect format)' End If Next DebugMessage 'Untrimmed Result: ' & GetRegularUserSIDS If Right(GetRegularUserSIDS,1) = ',' Then GetRegularUserSIDS = Left(GetRegularUserSIDS,Len(GetRegularUserSIDS)-1) GetRegularUserSIDS = split(GetRegularUserSIDS,',')End FunctionFunction GetUserIDorSIDInfo (UserIDorSID,LookupType) 'Version 1.1 ' Depends on CleanExtension() oReg.EnumKey WMI_HKLM, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList', arrSIDList For Each SID In arrSIDList oReg.GetExpandedStringValue WMI_HKLM,'SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\' & SID,'ProfileImagePath',ProfilePath if (instr(1,ucase(SID),ucase(UserIDorSID),1) > 0) OR (instr(1,ucase(ProfilePath),ucase(UserIDorSID),1) > 0) Then Select Case LookupType Case 'SID' GetUserIDorSIDInfo = CleanExtension(SID) Exit Function Case 'ProfileFolder' GetUserIDorSIDInfo = ProfilePath Exit Function Case 'UserID' GetUserIDorSIDInfo = CleanExtension(mid(ProfilePath,instrrev(ProfilePath,'\',-1,1)+1)) Exit Function Case Else GetUserIDorSIDInfo = 'Invalid LookUpType requested' Exit Function End Select Else GetUserIDorSIDInfo = 'No match found' End If Next Debugmessage GetUserIDorSIDInfoEnd FunctionFunction CleanExtension (SIDtoFix) 'take precautions against SID registry keys ending in .bak stripsid = split(SIDtoFix,'.') CleanExtension = stripsid(0)End FunctionFunction CSI_IsAdmin() 'Version 1.31 'http://csi-windows.com/toolkit/csi-isadmin CSI_IsAdmin = False On Error Resume Next key = CreateObject('WScript.Shell').RegRead('HKEY_USERS\S-1-5-19\Environment\TEMP') If err.number = 0 Then CSI_IsAdmin = TrueEnd Function'**********************************************''logging and debugging functionsFunction WinEventLog(Message,severity) MSGPREFIX = ' ' Select Case Severity Case EVT_INFORMATION MSGPREFIX = MSGPREFIX & 'INFO: ' Case EVT_WARNING MSGPREFIX = MSGPREFIX & 'WARNING: ' Case EVT_ERROR MSGPREFIX = MSGPREFIX & 'ERROR: ' End Select If bWinEventLogOn Then oShell.LogEvent severity, MSGPREFIX & Message If bDebugMessagesOn Then DebugMessage '(event log msgs): ' & MSGPREFIX & MessageEnd FunctionFunction DebugMessage (DbgMsg) MSGPREFIX = 'DEBUG MSG: ' If bDebugMessagesOn Then wsh.echo MSGPREFIX & DbgMsgEnd FunctionFunction UserMessage (UsrMsg) wsh.echo UsrMsgEnd Function'End logging and debugging functions'**********************************************'
粘贴到记事本,保存,改后缀为vbs,这是个批处理脚本。
以管理员身份运行,重启计算机,修复完成。
使用于64位系统
适用于windows 7 及以上系统,包括Vista。