-
Notifications
You must be signed in to change notification settings - Fork 0
/
Debloat.bat
57 lines (49 loc) · 1.45 KB
/
Debloat.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
@echo off
NET SESSION >NUL 2>NUL
IF %ERRORLEVEL% NEQ 0 (
echo Run Frontier with admin. This script wont work otherwise
)
shift /0
cd %systemroot%\system32
SETLOCAL EnableDelayedExpansion
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set "DEL=%%a"
goto :ABC
)
:ABC
cls
chcp 65001 >nul 2>&1
cd /d "%~dp0"
goto :unwantedfile
:unwantedfile
cls
set filesToDelete=C:\Windows\System32\GameBarPresenceWriter.exe C:\Windows\System32\smartscreen.exe C:\Windows\System32\Narrator.exe C:\Windows\System32\mcupdate_GenuineIntel.dll C:\Windows\HelpPane.exe C:\Windows\System32\mcupdate_AuthenticAMD.dll
for %%f in (%filesToDelete%) do (
if exist "%%f" (
echo Deleting "%%f"...
takeown /f "%%f" >nul 2>&1
icacls "%%f" /grant:r "%USERNAME%":F >nul 2>&1
taskkill /im "%%~nxf" /f >nul 2>&1
del /f /q "%%f" >nul 2>&1
echo "%%f" deleted.
)
)
cls
goto success
:success
cls
set msgboxTitle=Executed successfully
set msgboxBody=The unwanted files cleanup has been successful.
set tmpmsgbox=%temp%\~tmpmsgbox.vbs
if exist "%tmpmsgbox%" DEL /F /Q "%tmpmsgbox%"
echo msgbox "%msgboxBody%",0,"%msgboxTitle%">"%tmpmsgbox%"
WSCRIPT "%tmpmsgbox%"
echo [90mLoading Menu...
timeout 2 > nul
exit /B
:ColorText
echo off
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1
goto :eof