forked from ShadowWhisperer/Remove-MS-Edge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Remove-Edge.bat
60 lines (47 loc) · 2.11 KB
/
Remove-Edge.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
@echo off
::
:: Checks if Microsoft Edge is installed, and uninstall it and EdgeWebView
:: Only Works with the newer Edge, built on Chromium
::
:: Some systems error out, use the .exe version of this to fix
::
:: Creator: ShadowWhisperer
:: Github: https://github.com/ShadowWhisperer
:: Created: 12/09/2020
:: Updated: 07/08/2022
::
:: Check if ran as Admin
net session >nul 2>&1 || (echo. & echo Run Script As Admin & echo. & pause & exit)
:: Set Exist Variable - Check if Edge is intalled *Show Message, if not installed
set "EXIST=0"
:: Stop Edge Task
taskkill /im "msedge.exe" /f >nul 2>&1
:: Uninstall - Edge
if exist "C:\Program Files (x86)\Microsoft\Edge\Application\" (
for /f "delims=" %%a in ('dir /b "C:\Program Files (x86)\Microsoft\Edge\Application\"') do (
cd /d "C:\Program Files (x86)\Microsoft\Edge\Application\%%a\Installer\" >nul 2>&1
if exist "setup.exe" (
set "EXIST=1"
echo - Removing Microsoft Edge
start /w setup.exe --uninstall --system-level --force-uninstall)
))
:: Uninstall - EdgeWebView
if exist "C:\Program Files (x86)\Microsoft\EdgeWebView\Application\" (
for /f "delims=" %%a in ('dir /b "C:\Program Files (x86)\Microsoft\EdgeWebView\Application\"') do (
cd /d "C:\Program Files (x86)\Microsoft\EdgeWebView\Application\%%a\Installer\" >nul 2>&1
if exist "setup.exe" (
echo - Removing EdgeWebView
start /w setup.exe --uninstall --msedgewebview --system-level --force-uninstall)
))
:: Delete Edge desktop icon, from all users
for /f "delims=" %%a in ('dir /b "C:\Users"') do (
del /S /Q "C:\Users\%%a\Desktop\edge.lnk" >nul 2>&1
del /S /Q "C:\Users\%%a\Desktop\Microsoft Edge.lnk" >nul 2>&1)
:: Delete additional files
if exist "C:\Windows\System32\MicrosoftEdgeCP.exe" (
for /f "delims=" %%a in ('dir /b "C:\Windows\System32\MicrosoftEdge*"') do (
takeown /f "C:\Windows\System32\%%a" > NUL 2>&1
icacls "C:\Windows\System32\%%a" /inheritance:e /grant "%UserName%:(OI)(CI)F" /T /C > NUL 2>&1
del /S /Q "C:\Windows\System32\%%a" > NUL 2>&1))
:: Not Installed
if "%EXIST%"=="0" echo. & echo Edge ^(Chromium^) Is Not Installed & echo. & timeout /t 3 & exit