-
Notifications
You must be signed in to change notification settings - Fork 6
/
Remove-Edge.bat
91 lines (77 loc) · 2.82 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
@echo off
:: First Stop Microsoft Edge Task
taskkill /F /IM msedge.exe >nul 2>&1
CD %HOMEDRIVE%%HOMEPATH%\Desktop
echo %CD%
REM ************ Main process *****************
echo *** Removing Microsoft Edge ***
call :killdir C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe
call :killdir "C:\Program Files (x86)\Microsoft\Edge"
call :killdir "C:\Program Files (x86)\Microsoft\EdgeUpdate"
call :killdir "C:\Program Files (x86)\Microsoft\EdgeCore"
call :killdir "C:\Program Files (x86)\Microsoft\EdgeWebView"
call :killdir "%LOCALAPPDATA%\Microsoft\Edge"
call :killdir "%LOCALAPPDATA%\Microsoft\EdgeBho"
call :killdir "%LOCALAPPDATA%\Microsoft\EdgeUpdate"
echo *** Modifying registry ***
call :editreg
echo *** Removing shortcuts ***
call :delshortcut "C:\Users\Public\Desktop\Microsoft Edge.lnk"
call :delshortcut "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Microsoft Edge.lnk"
call :delshortcut "%APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Microsoft Edge.lnk"
echo Finished!
pause
exit
REM ************ KillDir: Take ownership and remove a directory *****************
:killdir
echo|set /p=Removing dir %1
if exist %1 (
takeown /a /r /d Y /f %1 > NUL
icacls %1 /grant administrators:f /t > NUL
rd /s /q %1 > NUL
if exist %1 (
echo ...Failed.
) else (
echo ...Deleted.
)
) else (
echo ...does not exist.
)
exit /B 0
REM ************ Edit registry to add do not update Edge key *****************
:editreg
echo|set /p=Editting registry
echo Windows Registry Editor Version 5.00 > RemoveEdge.reg
echo. >> RemoveEdge.reg
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\EdgeUpdate] >> RemoveEdge.reg
echo "DoNotUpdateToEdgeWithChromium"=dword:00000001 >> RemoveEdge.reg
echo. >> RemoveEdge.reg
echo [-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{9459C573-B17A-45AE-9F64-1857B5D58CEE}] >> RemoveEdge.reg
regedit /s RemoveEdge.reg
del RemoveEdge.reg
echo ...done.
exit /B 0
:: Delete Microsoft Edge Folders
rmdir /s /q "C:\Program Files (x86)\Microsoft\Edge"
rmdir /s /q "C:\Program Files (x86)\Microsoft\EdgeCore"
rmdir /s /q "C:\Program Files (x86)\Microsoft\EdgeWebView"
rmdir /s /q "C:\Program Files (x86)\Microsoft\Temp"
:: Delete Edge Icons, 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))
:delshortcut
echo|set /p=Removing shortcut %1
if exist %1 (
del %1
echo ...done.
) else (
echo ...does not exist.
)
exit /B 0