Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- setlocal enabledelayedexpansion
- REM -- check XHTML support (IE 9+)
- set xhtml=0
- for /f %%G in ('"reg query "HKCR\IE.AssocFile.XHT" /ve 2>&1 | findstr /c:".XHT" "') do set xhtml=1
- REM -- reset file extensions
- set exts=HTM,HTML
- if %xhtml% == 1 (set exts=%exts%,XHT,XHTML)
- for %%G in (%exts%) do (
- set ext=%%G
- set ext=!ext:~0,3!
- reg add "HKCU\Software\Classes\.%%G" /ve /t REG_SZ /d "IE.AssocFile.!ext!" /f >nul
- )
- set exts=%exts%,MHT,MHTML,URL
- set acl=%temp%\acl_%random%%random%.txt
- for %%G in (%exts%) do (
- set key=HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.%%G\UserChoice
- echo !key! [1 7 17]>"%acl%"
- regini "%acl%" >nul
- set ext=%%G
- set ext=!ext:~0,3!
- reg add "!key!" /v "Progid" /t REG_SZ /d "IE.AssocFile.!ext!" /f >nul
- )
- del "%acl%" 2>nul
- REM -- reset MIME associations
- for %%G in (message/rfc822,text/html) do (
- set key=HKCU\Software\Microsoft\Windows\Shell\Associations\MIMEAssociations\%%G\UserChoice
- reg add "!key!" /v "Progid" /t REG_SZ /d "IE.%%G" /f >nul
- )
- REM -- reset URL protocols
- for %%A in (FTP,HTTP,HTTPS) do (
- set key=HKCU\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\%%A\UserChoice
- reg add "!key!" /v "Progid" /t REG_SZ /d "IE.%%A" /f >nul
- for %%B in (DefaultIcon,shell) do (
- set key=HKCU\Software\Classes\%%A
- reg delete "!key!\%%B" /f >nul 2>&1
- reg copy "HKCR\IE.%%A\%%B" "!key!\%%B" /s /f >nul
- reg add "!key!" /v "EditFlags" /t REG_DWORD /d 2 /f >nul
- reg add "!key!" /v "URL Protocol" /t REG_SZ /d "" /f >nul
- ))
- REM -- reset the start menu Internet link (Vista and earlier)
- reg add "HKCU\Software\Clients\StartMenuInternet" /ve /t REG_SZ /d "IEXPLORE.EXE" /f
- REM -- reset cached icons
- if %xhtml% == 1 (
- ie4uinit -cleariconcache
- ) else (
- taskkill /im explorer.exe /f >nul
- start explorer
- )
- pause
- exit /b
- REM #############
- REM # START NOTES
- REM #############
- REM ## Reference:
- REM ## <https://superuser.com/questions/300770/set-internet-explorer-as-the-default-browser-from-the-command-line/300801>
- REM ## The following batch script simulates clicking Set this programs as default from the Default Programs control panel applet.
- REM ## Tested with Vista/7 and IE 7/IE 11.
- REM ## Any web browser application can register to appear as an Internet client on the Start menu.
- REM ## This visibility, coupled with proper registration for an application's file and protocol types, gives an application default browser status.
- REM ## The default web browser is used for launching arbitrary URLs from anywhere in the system.
- REM ## Note Existing [start menu link] registrations are ignored in Windows 7 and later. This registration is deprecated as of Windows 7.
- REM ## The hierarchical registry structure for file and protocol associations gives precedence to per-user defaults over machine-level defaults.
- REM ###########
- REM # END NOTES
- REM ###########
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement