mirror of
https://github.com/theitaliandeveloper/WindowsPPKGOptimizer.git
synced 2025-10-02 07:00:47 +00:00
169 lines
9.8 KiB
Batchfile
169 lines
9.8 KiB
Batchfile
@echo off
|
|
:main
|
|
echo Checking system...
|
|
if exist "%ProgramFiles%\Microsoft\Edge" goto uninstall32
|
|
if exist "%ProgramFiles(x86)%\Microsoft\Edge" goto uninstall64
|
|
goto noedge
|
|
|
|
:uninstall32
|
|
echo Edge was found!
|
|
echo Closing Edge...
|
|
taskkill /f /t /im msedge.exe > nul
|
|
taskkill /f /t /im MicrosoftEdgeUpdate.exe > nul
|
|
taskkill /f /t /im msedgewebview2.exe > nul
|
|
echo Uninstalling Edge...
|
|
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge" /f > nul
|
|
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge Update" /f > nul
|
|
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft EdgeWebView" /f > nul
|
|
reg delete "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{9459C573-B17A-45AE-9F64-1857B5D58CEE}" /f > nul
|
|
reg delete "HKLM\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate" /f > nul
|
|
net stop MicrosoftEdgeElevationService > nul
|
|
sc delete MicrosoftEdgeElevationService > nul
|
|
net stop edgeupdate > nul
|
|
sc delete edgeupdate > nul
|
|
net stop edgeupdatem > nul
|
|
sc delete edgeupdatem > nul
|
|
rd /s /q "%ProgramData%\Microsoft\EdgeUpdate" > nul
|
|
rd /s /q "%ProgramFiles%\Microsoft\Edge" > nul
|
|
rd /s /q "%ProgramFiles%\Microsoft\EdgeCore" > nul
|
|
rd /s /q "%ProgramFiles%\Microsoft\EdgeUpdate" > nul
|
|
rd /s /q "%ProgramFiles%\Microsoft\EdgeWebView" > nul
|
|
rd /s /q "%ProgramFiles%\Microsoft\Temp" > nul
|
|
del /f /q "%userprofile%\Desktop\Microsoft Edge.lnk" > nul
|
|
del /f /q "%systemdrive%\Users\Public\Desktop\Microsoft Edge.lnk" > nul
|
|
del /f /q "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Microsoft Edge.lnk" > nul
|
|
del /f /q "%appdata%\Microsoft\Windows\Start Menu\Programs\Microsoft Edge.lnk" > nul
|
|
del /f /q "%appdata%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Microsoft Edge.lnk" > nul
|
|
reg add "HKLM\Software\Microsoft\EdgeUpdate" /v "DoNotUpdateToEdgeWithChromium" /t REG_DWORD /d 1 /f > nul
|
|
for /f "delims=" %%f in ('dir /s /b %SystemRoot%\System32\Tasks\*MicrosoftEdge*') do (
|
|
takeown /f "%%f"
|
|
icacls "%%f" /grant everyone:F
|
|
del /f /q "%%f"
|
|
)
|
|
for /f "delims=" %%a in ('powershell "(New-Object System.Security.Principal.NTAccount($env:USERNAME)).Translate([System.Security.Principal.SecurityIdentifier]).Value"') do set "USER_SID=%%a"
|
|
for /f "delims=" %%a in ('powershell -NoProfile -Command "Get-AppxPackage -AllUsers | Where-Object { $_.PackageFullName -like '*microsoftedge*' } | Select-Object -ExpandProperty PackageFullName"') do (
|
|
if not "%%a"=="" (
|
|
set "APP=%%a"
|
|
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\EndOfLife\!USER_SID!\!APP!" /f >nul 2>&1
|
|
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\EndOfLife\S-1-5-18\!APP!" /f >nul 2>&1
|
|
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\Deprovisioned\!APP!" /f >nul 2>&1
|
|
powershell -Command "Remove-AppxPackage -Package '!APP!'" 2>nul
|
|
powershell -Command "Remove-AppxPackage -Package '!APP!' -AllUsers" 2>nul
|
|
)
|
|
)
|
|
for /f "delims=" %%f in ('dir /s /b %SystemRoot%\SystemApps\Microsoft.MicrosoftEdge*') do (
|
|
takeown /f "%%f"
|
|
icacls "%%f" /grant everyone:F
|
|
del /f /q "%%f"
|
|
)
|
|
for /f "delims=" %%f in ('dir /s /b %SystemRoot%\System32\MicrosoftEdge*.exe') do (
|
|
takeown /f "%%f"
|
|
icacls "%%f" /grant everyone:F
|
|
del /f /q "%%f"
|
|
)
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\Microsoft Edge" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications" /v "Microsoft Edge" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.htm\OpenWithProgIds" /v "MSEdgeHTM" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.html\OpenWithProgIds" /v "MSEdgeHTM" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.mht\OpenWithProgIds" /v "MSEdgeMHT" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.mhtml\OpenWithProgIds" /v "MSEdgeMHT" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.pdf\OpenWithProgIds" /v "MSEdgePDF" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.shtml\OpenWithProgIds" /v "MSEdgeHTM" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.svg\OpenWithProgIds" /v "MSEdgeHTM" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.webp\OpenWithProgIds" /v "MSEdgeHTM" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.xht\OpenWithProgIds" /v "MSEdgeHTM" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.xhtml\OpenWithProgIds" /v "MSEdgeHTM" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.xml\OpenWithProgIds" /v "MSEdgeHTM" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Edge" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\EdgeIntegration" /f
|
|
echo Microsoft Edge should be now uninstalled.
|
|
goto eof
|
|
|
|
:uninstall64
|
|
echo Edge was found!
|
|
echo Closing Edge...
|
|
taskkill /f /t /im msedge.exe > nul
|
|
taskkill /f /t /im MicrosoftEdgeUpdate.exe > nul
|
|
taskkill /f /t /im msedgewebview2.exe > nul
|
|
echo Uninstalling Edge...
|
|
reg delete "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge" /f > nul
|
|
reg delete "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge Update" /f > nul
|
|
reg delete "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft EdgeWebView" /f > nul
|
|
reg delete "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{9459C573-B17A-45AE-9F64-1857B5D58CEE}" /f > nul
|
|
reg delete "HKLM\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate" /f > nul
|
|
net stop MicrosoftEdgeElevationService > nul
|
|
sc delete MicrosoftEdgeElevationService > nul
|
|
net stop edgeupdate > nul
|
|
sc delete edgeupdate > nul
|
|
net stop edgeupdatem > nul
|
|
sc delete edgeupdatem > nul
|
|
rd /s /q "%ProgramData%\Microsoft\EdgeUpdate" > nul
|
|
rd /s /q "%ProgramFiles(x86)%\Microsoft\Edge" > nul
|
|
rd /s /q "%ProgramFiles(x86)%\Microsoft\EdgeCore" > nul
|
|
rd /s /q "%ProgramFiles(x86)%\Microsoft\EdgeUpdate" > nul
|
|
rd /s /q "%ProgramFiles(x86)%\Microsoft\EdgeWebView" > nul
|
|
rd /s /q "%ProgramFiles(x86)%\Microsoft\Temp" > nul
|
|
del /f /q "%userprofile%\Desktop\Microsoft Edge.lnk" > nul
|
|
del /f /q "%systemdrive%\Users\Public\Desktop\Microsoft Edge.lnk" > nul
|
|
del /f /q "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Microsoft Edge.lnk" > nul
|
|
del /f /q "%appdata%\Microsoft\Windows\Start Menu\Programs\Microsoft Edge.lnk" > nul
|
|
del /f /q "%appdata%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Microsoft Edge.lnk" > nul
|
|
reg add "HKLM\Software\Microsoft\EdgeUpdate" /v "DoNotUpdateToEdgeWithChromium" /t REG_DWORD /d 1 /f > nul
|
|
reg add "HKLM\Software\WOW6432Node\Microsoft\EdgeUpdate" /v "DoNotUpdateToEdgeWithChromium" /t REG_DWORD /d 1 /f > nul
|
|
for /f "delims=" %%f in ('dir /s /b %SystemRoot%\System32\Tasks\*MicrosoftEdge*') do (
|
|
takeown /f "%%f"
|
|
icacls "%%f" /grant everyone:F
|
|
del /f /q "%%f"
|
|
)
|
|
for /f "delims=" %%a in ('powershell "(New-Object System.Security.Principal.NTAccount($env:USERNAME)).Translate([System.Security.Principal.SecurityIdentifier]).Value"') do set "USER_SID=%%a"
|
|
for /f "delims=" %%a in ('powershell -NoProfile -Command "Get-AppxPackage -AllUsers | Where-Object { $_.PackageFullName -like '*microsoftedge*' } | Select-Object -ExpandProperty PackageFullName"') do (
|
|
if not "%%a"=="" (
|
|
set "APP=%%a"
|
|
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\EndOfLife\!USER_SID!\!APP!" /f >nul 2>&1
|
|
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\EndOfLife\S-1-5-18\!APP!" /f >nul 2>&1
|
|
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\Deprovisioned\!APP!" /f >nul 2>&1
|
|
powershell -Command "Remove-AppxPackage -Package '!APP!'" 2>nul
|
|
powershell -Command "Remove-AppxPackage -Package '!APP!' -AllUsers" 2>nul
|
|
)
|
|
)
|
|
for /f "delims=" %%f in ('dir /s /b %SystemRoot%\SystemApps\Microsoft.MicrosoftEdge*') do (
|
|
takeown /f "%%f"
|
|
icacls "%%f" /grant everyone:F
|
|
del /f /q "%%f"
|
|
)
|
|
for /f "delims=" %%f in ('dir /s /b %SystemRoot%\System32\MicrosoftEdge*.exe') do (
|
|
takeown /f "%%f"
|
|
icacls "%%f" /grant everyone:F
|
|
del /f /q "%%f"
|
|
)
|
|
for /f "delims=" %%f in ('dir /s /b %SystemRoot%\SysWOW64\MicrosoftEdge*.exe') do (
|
|
takeown /f "%%f"
|
|
icacls "%%f" /grant everyone:F
|
|
del /f /q "%%f"
|
|
)
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\Microsoft Edge" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications" /v "Microsoft Edge" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Clients\StartMenuInternet\Microsoft Edge" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\RegisteredApplications" /v "Microsoft Edge" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.htm\OpenWithProgIds" /v "MSEdgeHTM" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.html\OpenWithProgIds" /v "MSEdgeHTM" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.mht\OpenWithProgIds" /v "MSEdgeMHT" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.mhtml\OpenWithProgIds" /v "MSEdgeMHT" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.pdf\OpenWithProgIds" /v "MSEdgePDF" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.shtml\OpenWithProgIds" /v "MSEdgeHTM" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.svg\OpenWithProgIds" /v "MSEdgeHTM" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.webp\OpenWithProgIds" /v "MSEdgeHTM" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.xht\OpenWithProgIds" /v "MSEdgeHTM" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.xhtml\OpenWithProgIds" /v "MSEdgeHTM" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.xml\OpenWithProgIds" /v "MSEdgeHTM" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Edge" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Edge" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\EdgeIntegration" /f
|
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Internet Explorer\EdgeIntegration" /f
|
|
echo Microsoft Edge should be now uninstalled.
|
|
goto eof
|
|
|
|
:noedge
|
|
echo Preinstalled Edge Chromium was not found!
|
|
|
|
:eof |