Last active
July 11, 2023 05:27
-
-
Save davidruhmann/6311612 to your computer and use it in GitHub Desktop.
[Batch] Uninstall Internet Explorer 9, 10, or 11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
:: Usage script.bat [version [verify [reboot]]] | |
:: Version Prompt | |
setlocal | |
:Version | |
set "Input=%~1" | |
set /p "Input=> Which Version of Internet Explorer? (8, 9, 10, or 11): " | |
if defined Input set "Input=%Input:"=%" | |
if /i "%Input%"=="8" goto SetVersion | |
if /i "%Input%"=="9" goto SetVersion | |
if /i "%Input%"=="10" goto SetVersion | |
if /i "%Input%"=="11" goto SetVersion | |
endlocal & exit /b 1 | |
:SetVersion | |
endlocal & set "Version=%Input%" | |
:: Safety Prompt | |
setlocal | |
:Prompt | |
set "Input=%~2" | |
set /p "Input=> Uninstall Internet Explorer %Version%? (y or n): " | |
if defined Input set "Input=%Input:"=%" | |
if /i "%Input%"=="n" endlocal & exit /b 2 | |
if /i not "%Input:~-1%"=="y" goto :Prompt | |
endlocal | |
:: Force close any open IE windows | |
taskkill /IM iexplore.exe /T /F 2>nul | |
:: Uninstall the IE Update Packages | |
pushd "%SystemRoot%\servicing\Packages" | |
for /f "delims=" %%A in ('dir /a-d /b /o-d Microsoft-Windows-InternetExplorer-*~%Version%.*.mum 2^>nul') do ( | |
echo Uninstalling package %%~nA | |
start /w pkgmgr /up:"%%~nA" /quiet /norestart" | |
) || echo Packages for this product were not found. | |
popd | |
:: Restart Notice | |
echo Packages have been uninstalled. | |
echo. | |
echo The computer needs to be restarted to finish. | |
:: Restart Prompt | |
setlocal | |
:Restart | |
set "Input=%~3" | |
set /p "Input=> Restart Now? (y or n): " | |
if defined set "Input=%Input:"=%" | |
if /i "%Input%"=="n" endlocal & exit /b 3 | |
if /i not "%Input:~-1%"=="y" goto :Restart | |
endlocal | |
:: Restart | |
shutdown /r /t 15 /d p:4:2 /c "IE %Version% Uninstalled by %USERNAME%" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://social.technet.microsoft.com/Forums/ie/en-US/7845854f-f0ac-44ed-9fac-9268dbfa09b1/internet-explorer-9-silent-uninstall
http://social.technet.microsoft.com/Forums/ie/en-US/bcb2c049-e49e-4f2d-9ee0-87111057004c/command-line-uninstall-ie10-on-w7