Skip to content

Instantly share code, notes, and snippets.

@VickyDev986
Last active February 19, 2021 01:07
Show Gist options
  • Save VickyDev986/0162e81505434ae634332dea3e9dce89 to your computer and use it in GitHub Desktop.
Save VickyDev986/0162e81505434ae634332dea3e9dce89 to your computer and use it in GitHub Desktop.
Windows HDD & RAM Cleanup Solution
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
net file 1>NUL 2>NUL
if not '%errorlevel%' == '0' (
powershell Start-Process -FilePath "%0" -ArgumentList "%cd%" -verb runas >NUL 2>&1
exit /b
)
cd /d %1
:WinSpclTskMgr
cls
echo 1: Cleanup HDD Space^
2: NTFS Compress WinSXS^
3: Kill Rebootable Processes^
4: Restart Windows Explorer^
5: Exit this application && echo.
choice /n /c 12345 /m "Select any of given tasks: "
if %errorlevel% == 1 (
SET PathsToClean=%Temp% "%ProgramFiles(x86)%"\Microsoft\Temp %WinDir%\Logs %SystemRoot%\Temp ^
%WinDir%\TempInst %SystemDrive%\OneDriveTemp %UserProfile%\Videos\AnyDesk %WinDir%\WinSXS\Temp ^
%ProgramData%\Microsoft\"Windows Defender"\Scans\History\ReportLatency\Latency
(FOR %%P IN (!PathsToClean!) DO ( ECHO %%P && RD /S /Q %%P )) 2>NUL
SET FilesToPurge=%ProgramData%\Microsoft\"Windows Defender"\Scans\mpcache-*
(FOR %%P IN (!FilesToPurge!) DO ( ECHO %%P && DEL /S /Q %%P )) 2>NUL
DEL /S /Q /F %LocalAppData%\Google\Drive\user_default\*.log && RD /S /Q %LocalAppData%\Google\Drive\user_default\TempData\
for /f "delims=" %%i in ('dir /a:d /s /b %SystemRoot%\Logs') do rd /s /q %%i
for /f "delims=" %%i in ('dir /a:d /s /b %SystemRoot%\Cache*') do rd /s /q %%i
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Logs') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Cache*') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Sys*?Logs') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b %windir%\softwaredistribution\Down*') do rd /s /q %%i
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.log
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
rd /s /q %windir%\temp & md %windir%\temp
del /f /q %userprofile%\cookies\*.*
del /f /q %userprofile%\recent\*.*
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
del /f /s /q "%userprofile%\recent\*.*"
del /s /f /q %userprofile%\Recent\*.*
del /s /f /q %SystemRoot%\Prefetch\*.*
del /s /f /q %SystemRoot%\Temp\*.*
del /s /f /q %USERPROFILE%\appdata\local\temp\*.*
del /s /f /q %windir%\system32\dllcache\*.*
rd /s /q %windir%\system32\dllcache
md %windir%\system32\dllcache
del /s /f /q "%SysteDrive%\Temp"\*.*
rd /s /q "%SysteDrive%\Temp"
md "%SysteDrive%\Temp"
del /s /f /q "%USERPROFILE%\Local Settings\History"\*.*
rd /s /q "%USERPROFILE%\Local Settings\History"
md "%USERPROFILE%\Local Settings\History"
del /s /f /q "%USERPROFILE%\Local Settings\Temporary Internet Files"\*.*
rd /s /q "%USERPROFILE%\Local Settings\Temporary Internet Files"
md "%USERPROFILE%\Local Settings\Temporary Internet Files"
del /s /f /q "%USERPROFILE%\Local Settings\Temp"\*.*
rd /s /q "%USERPROFILE%\Local Settings\Temp"
md "%USERPROFILE%\Local Settings\Temp"
del /s /f /q "%USERPROFILE%\Recent"\*.*
rd /s /q "%USERPROFILE%\Recent"
md "%USERPROFILE%\Recent"
del /s /f /q "%USERPROFILE%\Cookies"\*.*
rd /s /q "%USERPROFILE%\Cookies"
md "%USERPROFILE%\Cookies"
) else if %errorlevel% == 2 (
goto CmprsWinSXSFldr
) else if %errorlevel% == 3 (
SET CCleanerExc="C:\Program Files\CCleaner\CCleaner64.exe"
cd /d %LOCALAPPDATA%\Microsoft\OneDrive && OneDrive.exe /shutdown
TASKKILL /F /IM MsEdge.exe /IM OneDrive.exe /IM MicrosoftPhotos.exe /IM MicrosoftEdge.exe /IM MicrosoftEdgeCP.exe /IM Chrome.exe ^
/IM GoogleCrashHandler.exe /IM GoogleCrashHandler64.exe /IM MicrosoftEdgeSH.exe /IM Ccleaner64.exe /IM IDMan.exe /IM IDMBroker.exe ^
/IM IDMIntegrator64.exe /IM sublime_text.exe /IM Firefox.exe /IM AnyDesk.exe /IM Slack.exe /IM Teams.exe /IM uTorrent.exe ^
/IM PWRISOVM.exe /IM openvpn-gui.exe /IM openvpnserv.exe /IM Lightshot.exe /IM GoogleDriveSync.exe /IM RuntimeBroker.exe /IM Update.exe ^
/IM ETDCtrl.exe /IM ETDCtrlHelper.exe /IM ETDTouch.exe /IM TrayMenu.exe /IM PAStarter.exe /T
!CCleanerExc! /Auto && !CCleanerExc! /Auto && !CCleanerExc! /Registry && TIMEOUT /T -1 && TASKKILL /F /IM Ccleaner64.exe /T
) else if %errorlevel% == 4 (
taskkill /f /im explorer.exe && start /wait explorer.exe
taskkill /f /t /im conhost.exe /im cmd.exe /im bash.exe
) else if %errorlevel% == 5 (
exit /b 0
)
pause > nul
goto WinSpclTskMgr
:CmprsWinSXSFldr
sc stop msiserver
sc stop TrustedInstaller
sc config msiserver start= disabled
sc config TrustedInstaller start= disabled
icacls "%WINDIR%\WinSxS" /save "%WINDIR%\WinSxS_NTFS.acl" /t
takeown /f "%WINDIR%\WinSxS" /r
icacls "%WINDIR%\WinSxS" /grant "%USERDOMAIN%\%USERNAME%":(F) /t
compact /s:"%WINDIR%\WinSxS" /c /a /i *
icacls "%WINDIR%\WinSxS" /setowner "NT SERVICE\TrustedInstaller" /t
icacls "%WINDIR%" /restore "%WINDIR%\WinSxS_NTFS.acl"
sc config msiserver start= demand
sc config TrustedInstaller start= demand
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
net file 1>NUL 2>NUL
if not '%errorlevel%' == '0' (
powershell Start-Process -FilePath "%0" -ArgumentList "%cd%" -verb runas >NUL 2>&1
exit /b
)
cd /d %1
:WinSpclTskMgr
cls
echo 1: Cleanup HDD Space^
2: NTFS Compress WinSXS^
3: Kill Rebootable Processes^
4: Restart Windows Explorer^
5: Exit this application && echo.
choice /n /c 12345 /m "Select any of given tasks: "
if %errorlevel% == 1 (
SET PathsToClean=%Temp% "%ProgramFiles(x86)%"\Microsoft\Temp %WinDir%\Logs %SystemRoot%\Temp ^
%WinDir%\TempInst %SystemDrive%\OneDriveTemp %UserProfile%\Videos\AnyDesk %WinDir%\WinSXS\Temp ^
%ProgramData%\Microsoft\"Windows Defender"\Scans\History\ReportLatency\Latency
(FOR %%P IN (!PathsToClean!) DO ( ECHO %%P && RD /S /Q %%P )) 2>NUL
SET FilesToPurge=%ProgramData%\Microsoft\"Windows Defender"\Scans\mpcache-*
(FOR %%P IN (!FilesToPurge!) DO ( ECHO %%P && DEL /S /Q %%P )) 2>NUL
DEL /S /Q /F %LocalAppData%\Google\Drive\user_default\*.log && RD /S /Q %LocalAppData%\Google\Drive\user_default\TempData\
for /f "delims=" %%i in ('dir /a:d /s /b %SystemRoot%\Logs') do rd /s /q %%i
for /f "delims=" %%i in ('dir /a:d /s /b %SystemRoot%\Cache*') do rd /s /q %%i
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Logs') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Cache*') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Sys*?Logs') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b %windir%\softwaredistribution\Down*') do rd /s /q %%i
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.log
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
rd /s /q %windir%\temp & md %windir%\temp
del /f /q %userprofile%\cookies\*.*
del /f /q %userprofile%\recent\*.*
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
del /f /s /q "%userprofile%\recent\*.*"
del /s /f /q %userprofile%\Recent\*.*
del /s /f /q %SystemRoot%\Prefetch\*.*
del /s /f /q %SystemRoot%\Temp\*.*
del /s /f /q %USERPROFILE%\appdata\local\temp\*.*
del /s /f /q %windir%\system32\dllcache\*.*
rd /s /q %windir%\system32\dllcache
md %windir%\system32\dllcache
del /s /f /q "%SysteDrive%\Temp"\*.*
rd /s /q "%SysteDrive%\Temp"
md "%SysteDrive%\Temp"
del /s /f /q "%USERPROFILE%\Local Settings\History"\*.*
rd /s /q "%USERPROFILE%\Local Settings\History"
md "%USERPROFILE%\Local Settings\History"
del /s /f /q "%USERPROFILE%\Local Settings\Temporary Internet Files"\*.*
rd /s /q "%USERPROFILE%\Local Settings\Temporary Internet Files"
md "%USERPROFILE%\Local Settings\Temporary Internet Files"
del /s /f /q "%USERPROFILE%\Local Settings\Temp"\*.*
rd /s /q "%USERPROFILE%\Local Settings\Temp"
md "%USERPROFILE%\Local Settings\Temp"
del /s /f /q "%USERPROFILE%\Recent"\*.*
rd /s /q "%USERPROFILE%\Recent"
md "%USERPROFILE%\Recent"
del /s /f /q "%USERPROFILE%\Cookies"\*.*
rd /s /q "%USERPROFILE%\Cookies"
md "%USERPROFILE%\Cookies"
) else if %errorlevel% == 2 (
goto CmprsWinSXSFldr
) else if %errorlevel% == 3 (
SET CCleanerExc="C:\Program Files\CCleaner\CCleaner64.exe"
cd /d %LOCALAPPDATA%\Microsoft\OneDrive && OneDrive.exe /shutdown
TASKKILL /F /IM MsEdge.exe /IM OneDrive.exe /IM MicrosoftPhotos.exe /IM MicrosoftEdge.exe /IM MicrosoftEdgeCP.exe /IM Chrome.exe ^
/IM GoogleCrashHandler.exe /IM GoogleCrashHandler64.exe /IM MicrosoftEdgeSH.exe /IM Ccleaner64.exe /IM IDMan.exe /IM IDMBroker.exe ^
/IM IDMIntegrator64.exe /IM sublime_text.exe /IM Firefox.exe /IM AnyDesk.exe /IM Slack.exe /IM Teams.exe /IM uTorrent.exe ^
/IM PWRISOVM.exe /IM openvpn-gui.exe /IM openvpnserv.exe /IM Lightshot.exe /IM GoogleDriveSync.exe /IM RuntimeBroker.exe /IM Update.exe ^
/IM ETDCtrl.exe /IM ETDCtrlHelper.exe /IM ETDTouch.exe /IM TrayMenu.exe /IM PAStarter.exe /T
!CCleanerExc! /Auto && !CCleanerExc! /Auto && !CCleanerExc! /Registry && TIMEOUT /T -1 && TASKKILL /F /IM Ccleaner64.exe /T
) else if %errorlevel% == 4 (
taskkill /f /im explorer.exe && start /wait explorer.exe
taskkill /f /t /im conhost.exe /im cmd.exe /im bash.exe
) else if %errorlevel% == 5 (
exit /b 0
)
pause > nul
goto WinSpclTskMgr
:CmprsWinSXSFldr
sc stop msiserver
sc stop TrustedInstaller
sc config msiserver start= disabled
sc config TrustedInstaller start= disabled
icacls "%WINDIR%\WinSxS" /save "%WINDIR%\WinSxS_NTFS.acl" /t
takeown /f "%WINDIR%\WinSxS" /r
icacls "%WINDIR%\WinSxS" /grant "%USERDOMAIN%\%USERNAME%":(F) /t
compact /s:"%WINDIR%\WinSxS" /c /a /i *
icacls "%WINDIR%\WinSxS" /setowner "NT SERVICE\TrustedInstaller" /t
icacls "%WINDIR%" /restore "%WINDIR%\WinSxS_NTFS.acl"
sc config msiserver start= demand
sc config TrustedInstaller start= demand
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
net file 1>NUL 2>NUL
if not '%errorlevel%' == '0' (
powershell Start-Process -FilePath "%0" -ArgumentList "%cd%" -verb runas >NUL 2>&1
exit /b
)
cd /d %1
:WinSpclTskMgr
cls
echo 1: Cleanup HDD Space^
2: NTFS Compress WinSXS^
3: Kill Rebootable Processes^
4: Restart Windows Explorer^
5: Stop+Clean Windows Updates^
6: Exit this application && echo.
choice /n /c 123456 /m "Select any of given tasks: "
if %errorlevel% == 1 (
SET PathsToClean=%Temp% "%ProgramFiles(x86)%"\Microsoft\Temp %WinDir%\Logs %SystemRoot%\Temp ^
%WinDir%\TempInst %SystemDrive%\OneDriveTemp %UserProfile%\Videos\AnyDesk %WinDir%\WinSXS\Temp ^
%ProgramData%\Microsoft\"Windows Defender"\Scans\History\ReportLatency\Latency
(FOR %%P IN (!PathsToClean!) DO ( ECHO %%P && RD /S /Q %%P )) 2>NUL
SET FilesToPurge=%ProgramData%\Microsoft\"Windows Defender"\Scans\mpcache-*
(FOR %%P IN (!FilesToPurge!) DO ( ECHO %%P && DEL /S /Q %%P )) 2>NUL
DEL /S /Q /F %LocalAppData%\Google\Drive\user_default\*.log && RD /S /Q %LocalAppData%\Google\Drive\user_default\TempData\
for /f "delims=" %%i in ('dir /a:d /s /b %SystemRoot%\Logs') do rd /s /q %%i
for /f "delims=" %%i in ('dir /a:d /s /b %SystemRoot%\Cache*') do rd /s /q %%i
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Logs') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Cache*') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Sys*?Logs') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b %windir%\softwaredistribution\Down*') do rd /s /q %%i
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.log
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
rd /s /q %windir%\temp & md %windir%\temp
del /f /q %userprofile%\cookies\*.*
del /f /q %userprofile%\recent\*.*
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
del /f /s /q "%userprofile%\recent\*.*"
del /s /f /q %userprofile%\Recent\*.*
del /s /f /q %SystemRoot%\Prefetch\*.*
del /s /f /q %SystemRoot%\Temp\*.*
del /s /f /q %USERPROFILE%\appdata\local\temp\*.*
del /s /f /q %windir%\system32\dllcache\*.*
rd /s /q %windir%\system32\dllcache
md %windir%\system32\dllcache
del /s /f /q "%SysteDrive%\Temp"\*.*
rd /s /q "%SysteDrive%\Temp"
md "%SysteDrive%\Temp"
del /s /f /q "%USERPROFILE%\Local Settings\History"\*.*
rd /s /q "%USERPROFILE%\Local Settings\History"
md "%USERPROFILE%\Local Settings\History"
del /s /f /q "%USERPROFILE%\Local Settings\Temporary Internet Files"\*.*
rd /s /q "%USERPROFILE%\Local Settings\Temporary Internet Files"
md "%USERPROFILE%\Local Settings\Temporary Internet Files"
del /s /f /q "%USERPROFILE%\Local Settings\Temp"\*.*
rd /s /q "%USERPROFILE%\Local Settings\Temp"
md "%USERPROFILE%\Local Settings\Temp"
del /s /f /q "%USERPROFILE%\Recent"\*.*
rd /s /q "%USERPROFILE%\Recent"
md "%USERPROFILE%\Recent"
del /s /f /q "%USERPROFILE%\Cookies"\*.*
rd /s /q "%USERPROFILE%\Cookies"
md "%USERPROFILE%\Cookies"
) else if %errorlevel% == 2 (
goto CmprsWinSXSFldr
) else if %errorlevel% == 3 (
SET CCleanerExc="C:\Program Files\CCleaner\CCleaner64.exe"
cd /d %LOCALAPPDATA%\Microsoft\OneDrive && OneDrive.exe /shutdown
TASKKILL /F /IM MsEdge.exe /IM OneDrive.exe /IM MicrosoftPhotos.exe /IM MicrosoftEdge.exe /IM MicrosoftEdgeCP.exe /IM Chrome.exe ^
/IM GoogleCrashHandler.exe /IM GoogleCrashHandler64.exe /IM MicrosoftEdgeSH.exe /IM Ccleaner64.exe /IM IDMan.exe /IM IDMBroker.exe ^
/IM IDMIntegrator64.exe /IM sublime_text.exe /IM Firefox.exe /IM AnyDesk.exe /IM Slack.exe /IM Teams.exe /IM uTorrent.exe ^
/IM PWRISOVM.exe /IM openvpn-gui.exe /IM openvpnserv.exe /IM Lightshot.exe /IM GoogleDriveSync.exe /IM RuntimeBroker.exe /IM Update.exe ^
/IM ETDCtrl.exe /IM ETDCtrlHelper.exe /IM ETDTouch.exe /IM TrayMenu.exe /IM PAStarter.exe /T
!CCleanerExc! /Auto && !CCleanerExc! /Auto && !CCleanerExc! /Registry && TIMEOUT /T -1 && TASKKILL /F /IM Ccleaner64.exe /T
) else if %errorlevel% == 4 (
taskkill /f /im explorer.exe && start /wait explorer.exe
taskkill /f /t /im conhost.exe /im cmd.exe /im bash.exe
) else if %errorlevel% == 5 (
goto DsblWindowsUpdts
) else if %errorlevel% == 6 (
exit /b 0
)
pause > nul
goto WinSpclTskMgr
:CmprsWinSXSFldr
sc stop msiserver
sc stop TrustedInstaller
sc config msiserver start= disabled
sc config TrustedInstaller start= disabled
icacls "%WINDIR%\WinSxS" /save "%WINDIR%\WinSxS_NTFS.acl" /t
takeown /f "%WINDIR%\WinSxS" /r
icacls "%WINDIR%\WinSxS" /grant "%USERDOMAIN%\%USERNAME%":(F) /t
compact /s:"%WINDIR%\WinSxS" /c /a /i *
icacls "%WINDIR%\WinSxS" /setowner "NT SERVICE\TrustedInstaller" /t
icacls "%WINDIR%" /restore "%WINDIR%\WinSxS_NTFS.acl"
sc config msiserver start= demand
sc config TrustedInstaller start= demand
:DsblWindowsUpdts
Net Stop bits & Net Stop wuauserv & Net Stop appidsvc & Net Stop cryptsvc & Net Stop msiserver
Set "Dir1=%WinDir%\Downloaded Program Files" && Call Del /f /s /q %%Dir1%%\* 2>nul && Call RmDir /s /q %%Dir1%%
Set "Dir2=%WinDir%\SoftwareDistribution\Download" && Call Del /f /s /q %%Dir2%%\* 2>nul && Call RmDir /s /q %%Dir2%%
Set "Dir3=%WinDir%\SoftwareDistribution\DataStore" && Call Del /f /s /q %%Dir3%%\* 2>nul && Call RmDir /s /q %%Dir3%%
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
net file 1>NUL 2>NUL
if not '%errorlevel%' == '0' (
powershell Start-Process -FilePath "%0" -ArgumentList "%cd%" -verb runas >NUL 2>&1
exit /b
)
cd /d %1
:WinSpclTskMgr
cls
echo 1: Cleanup HDD Space^
2: NTFS Compress WinSXS^
3: Kill Rebootable Processes^
4: Restart Windows Explorer^
5: Stop+Clean Windows Updates^
6: Exit this application && echo.
choice /n /c 123456 /m "Select any of given tasks: "
if %errorlevel% == 1 (
SET PathsToClean=%Temp% "%ProgramFiles(x86)%"\Microsoft\Temp %WinDir%\Logs %SystemRoot%\Temp ^
%WinDir%\TempInst %SystemDrive%\OneDriveTemp %UserProfile%\Videos\AnyDesk %WinDir%\WinSXS\Temp ^
%ProgramData%\Microsoft\"Windows Defender"\Scans\History\ReportLatency\Latency
(FOR %%P IN (!PathsToClean!) DO ( ECHO %%P && RD /S /Q %%P )) 2>NUL
SET FilesToPurge=%ProgramData%\Microsoft\"Windows Defender"\Scans\mpcache-*
(FOR %%P IN (!FilesToPurge!) DO ( ECHO %%P && DEL /S /Q %%P )) 2>NUL
DEL /S /Q /F %LocalAppData%\Google\Drive\user_default\*.log && RD /S /Q %LocalAppData%\Google\Drive\user_default\TempData\
for /f "delims=" %%i in ('dir /a:d /s /b %SystemRoot%\Logs') do rd /s /q %%i
for /f "delims=" %%i in ('dir /a:d /s /b %SystemRoot%\Cache*') do rd /s /q %%i
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Logs') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Cache*') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Sys*?Logs') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b %windir%\softwaredistribution\Down*') do rd /s /q %%i
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.log
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
rd /s /q %windir%\temp & md %windir%\temp
del /f /q %userprofile%\cookies\*.*
del /f /q %userprofile%\recent\*.*
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
del /f /s /q "%userprofile%\recent\*.*"
del /s /f /q %userprofile%\Recent\*.*
del /s /f /q %SystemRoot%\Prefetch\*.*
del /s /f /q %SystemRoot%\Temp\*.*
del /s /f /q %USERPROFILE%\appdata\local\temp\*.*
del /s /f /q %windir%\system32\dllcache\*.*
rd /s /q %windir%\system32\dllcache
md %windir%\system32\dllcache
del /s /f /q "%SysteDrive%\Temp"\*.*
rd /s /q "%SysteDrive%\Temp"
md "%SysteDrive%\Temp"
del /s /f /q "%USERPROFILE%\Local Settings\History"\*.*
rd /s /q "%USERPROFILE%\Local Settings\History"
md "%USERPROFILE%\Local Settings\History"
del /s /f /q "%USERPROFILE%\Local Settings\Temporary Internet Files"\*.*
rd /s /q "%USERPROFILE%\Local Settings\Temporary Internet Files"
md "%USERPROFILE%\Local Settings\Temporary Internet Files"
del /s /f /q "%USERPROFILE%\Local Settings\Temp"\*.*
rd /s /q "%USERPROFILE%\Local Settings\Temp"
md "%USERPROFILE%\Local Settings\Temp"
del /s /f /q "%USERPROFILE%\Recent"\*.*
rd /s /q "%USERPROFILE%\Recent"
md "%USERPROFILE%\Recent"
del /s /f /q "%USERPROFILE%\Cookies"\*.*
rd /s /q "%USERPROFILE%\Cookies"
md "%USERPROFILE%\Cookies"
) else if %errorlevel% == 2 (
goto CmprsWinSXSFldr
) else if %errorlevel% == 3 (
SET CCleanerExc="C:\Program Files\CCleaner\CCleaner64.exe"
cd /d %LOCALAPPDATA%\Microsoft\OneDrive && OneDrive.exe /shutdown
TASKKILL /F /IM MsEdge.exe /IM OneDrive.exe /IM MicrosoftPhotos.exe /IM MicrosoftEdge.exe /IM MicrosoftEdgeCP.exe /IM Chrome.exe ^
/IM GoogleCrashHandler.exe /IM GoogleCrashHandler64.exe /IM MicrosoftEdgeSH.exe /IM Ccleaner64.exe /IM IDMan.exe /IM IDMBroker.exe ^
/IM IDMIntegrator64.exe /IM sublime_text.exe /IM Firefox.exe /IM AnyDesk.exe /IM Slack.exe /IM Teams.exe /IM uTorrent.exe ^
/IM PWRISOVM.exe /IM openvpn-gui.exe /IM openvpnserv.exe /IM Lightshot.exe /IM GoogleDriveSync.exe /IM RuntimeBroker.exe /IM Update.exe ^
/IM ETDCtrl.exe /IM ETDCtrlHelper.exe /IM ETDTouch.exe /IM TrayMenu.exe /IM PAStarter.exe /T
!CCleanerExc! /Auto && !CCleanerExc! /Auto && !CCleanerExc! /Registry && TIMEOUT /T -1 && TASKKILL /F /IM Ccleaner64.exe /T
) else if %errorlevel% == 4 (
taskkill /f /im explorer.exe && start /wait explorer.exe
taskkill /f /t /im conhost.exe /im cmd.exe /im bash.exe
) else if %errorlevel% == 5 (
goto DsblWindowsUpdts
) else if %errorlevel% == 6 (
exit /b 0
)
pause > nul
goto WinSpclTskMgr
:CmprsWinSXSFldr
sc stop msiserver
sc stop TrustedInstaller
sc config msiserver start= disabled
sc config TrustedInstaller start= disabled
icacls "%WINDIR%\WinSxS" /save "%WINDIR%\WinSxS_NTFS.acl" /t
takeown /f "%WINDIR%\WinSxS" /r
icacls "%WINDIR%\WinSxS" /grant "%USERDOMAIN%\%USERNAME%":(F) /t
compact /s:"%WINDIR%\WinSxS" /c /a /i *
icacls "%WINDIR%\WinSxS" /setowner "NT SERVICE\TrustedInstaller" /t
icacls "%WINDIR%" /restore "%WINDIR%\WinSxS_NTFS.acl"
sc config msiserver start= demand
sc config TrustedInstaller start= demand
:DsblWindowsUpdts
Net Stop bits & Net Stop wuauserv & Net Stop appidsvc & Net Stop cryptsvc & Net Stop msiserver
Set "Dir1=%WinDir%\Downloaded Program Files" && Call Del /f /s /q %%Dir1%%\* 2>nul && Call RmDir /s /q %%Dir1%%
Set "Dir2=%WinDir%\SoftwareDistribution\Download" && Call Del /f /s /q %%Dir2%%\* 2>nul && Call RmDir /s /q %%Dir2%%
Set "Dir3=%WinDir%\SoftwareDistribution\DataStore" && Call Del /f /s /q %%Dir3%%\* 2>nul && Call RmDir /s /q %%Dir3%%
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
net file 1>NUL 2>NUL
if not '%errorlevel%' == '0' (
powershell Start-Process -FilePath "%0" -ArgumentList "%cd%" -verb runas >NUL 2>&1
exit /b
)
cd /d %1
:WinSpclTskMgr
cls
echo 1: Cleanup HDD Space^
2: NTFS Compress WinSXS^
3: Kill Rebootable Processes^
4: Restart Windows Explorer^
5: Stop+Clean Windows Updates^
6: Cleanup WinSXS Directory^
7: Exit this application && echo.
choice /n /c 1234567 /m "Select any of given tasks: "
if %errorlevel% == 1 (
SET PathsToClean=%Temp% "%ProgramFiles(x86)%"\Microsoft\Temp %WinDir%\Logs %SystemRoot%\Temp ^
%WinDir%\TempInst %SystemDrive%\OneDriveTemp %UserProfile%\Videos\AnyDesk %WinDir%\WinSXS\Temp ^
%ProgramData%\Microsoft\"Windows Defender"\Scans\History\ReportLatency\Latency
(FOR %%P IN (!PathsToClean!) DO ( ECHO %%P && RD /S /Q %%P )) 2>NUL
SET FilesToPurge=%ProgramData%\Microsoft\"Windows Defender"\Scans\mpcache-*
(FOR %%P IN (!FilesToPurge!) DO ( ECHO %%P && DEL /S /Q %%P )) 2>NUL
DEL /S /Q /F %LocalAppData%\Google\Drive\user_default\*.log && RD /S /Q %LocalAppData%\Google\Drive\user_default\TempData\
for /f "delims=" %%i in ('dir /a:d /s /b %SystemRoot%\Logs') do rd /s /q %%i
for /f "delims=" %%i in ('dir /a:d /s /b %SystemRoot%\Cache*') do rd /s /q %%i
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Logs') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Cache*') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Sys*?Logs') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b %windir%\softwaredistribution\Down*') do rd /s /q %%i
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.log
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
rd /s /q %windir%\temp & md %windir%\temp
del /f /q %userprofile%\cookies\*.*
del /f /q %userprofile%\recent\*.*
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
del /f /s /q "%userprofile%\recent\*.*"
del /s /f /q %userprofile%\Recent\*.*
del /s /f /q %SystemRoot%\Prefetch\*.*
del /s /f /q %SystemRoot%\Temp\*.*
del /s /f /q %USERPROFILE%\appdata\local\temp\*.*
del /s /f /q %windir%\system32\dllcache\*.*
rd /s /q %windir%\system32\dllcache
md %windir%\system32\dllcache
del /s /f /q "%SysteDrive%\Temp"\*.*
rd /s /q "%SysteDrive%\Temp"
md "%SysteDrive%\Temp"
del /s /f /q "%USERPROFILE%\Local Settings\History"\*.*
rd /s /q "%USERPROFILE%\Local Settings\History"
md "%USERPROFILE%\Local Settings\History"
del /s /f /q "%USERPROFILE%\Local Settings\Temporary Internet Files"\*.*
rd /s /q "%USERPROFILE%\Local Settings\Temporary Internet Files"
md "%USERPROFILE%\Local Settings\Temporary Internet Files"
del /s /f /q "%USERPROFILE%\Local Settings\Temp"\*.*
rd /s /q "%USERPROFILE%\Local Settings\Temp"
md "%USERPROFILE%\Local Settings\Temp"
del /s /f /q "%USERPROFILE%\Recent"\*.*
rd /s /q "%USERPROFILE%\Recent"
md "%USERPROFILE%\Recent"
del /s /f /q "%USERPROFILE%\Cookies"\*.*
rd /s /q "%USERPROFILE%\Cookies"
md "%USERPROFILE%\Cookies"
) else if %errorlevel% == 2 (
goto CmprsWinSXSFldr
) else if %errorlevel% == 3 (
SET CCleanerExc="C:\Program Files\CCleaner\CCleaner64.exe"
cd /d %LOCALAPPDATA%\Microsoft\OneDrive && OneDrive.exe /shutdown
TASKKILL /F /IM MsEdge.exe /IM OneDrive.exe /IM MicrosoftPhotos.exe /IM MicrosoftEdge.exe /IM MicrosoftEdgeCP.exe /IM Chrome.exe ^
/IM GoogleCrashHandler.exe /IM GoogleCrashHandler64.exe /IM MicrosoftEdgeSH.exe /IM Ccleaner64.exe /IM IDMan.exe /IM IDMBroker.exe ^
/IM IDMIntegrator64.exe /IM sublime_text.exe /IM Firefox.exe /IM AnyDesk.exe /IM Slack.exe /IM Teams.exe /IM uTorrent.exe ^
/IM PWRISOVM.exe /IM openvpn-gui.exe /IM openvpnserv.exe /IM Lightshot.exe /IM GoogleDriveSync.exe /IM RuntimeBroker.exe /IM Update.exe ^
/IM ETDCtrl.exe /IM ETDCtrlHelper.exe /IM ETDTouch.exe /IM TrayMenu.exe /IM PAStarter.exe /T
!CCleanerExc! /Auto && !CCleanerExc! /Auto && !CCleanerExc! /Registry && TIMEOUT /T -1 && TASKKILL /F /IM Ccleaner64.exe /T
) else if %errorlevel% == 4 (
taskkill /f /im explorer.exe && start /wait explorer.exe
taskkill /f /t /im conhost.exe /im cmd.exe /im bash.exe
) else if %errorlevel% == 5 (
goto DsblWindowsUpdts
) else if %errorlevel% == 6 (
goto ClnpPrgWinSXSFldr
) else if %errorlevel% == 7 (
exit /b 0
)
echo. && pause && goto WinSpclTskMgr
:CmprsWinSXSFldr
sc stop msiserver
sc stop TrustedInstaller
sc config msiserver start= disabled
sc config TrustedInstaller start= disabled
icacls "%WINDIR%\WinSxS" /save "%WINDIR%\WinSxS_NTFS.acl" /t
takeown /f "%WINDIR%\WinSxS" /r
icacls "%WINDIR%\WinSxS" /grant "%USERDOMAIN%\%USERNAME%":(F) /t
compact /s:"%WINDIR%\WinSxS" /c /a /i *
icacls "%WINDIR%\WinSxS" /setowner "NT SERVICE\TrustedInstaller" /t
icacls "%WINDIR%" /restore "%WINDIR%\WinSxS_NTFS.acl"
del /f /s /q %WINDIR%\WinSxS_NTFS.acl
sc config msiserver start= demand
sc config TrustedInstaller start= demand
echo. && pause && goto WinSpclTskMgr
:ClnpPrgWinSXSFldr
sc stop msiserver
sc stop TrustedInstaller
sc config msiserver start= disabled
sc config TrustedInstaller start= disabled
icacls "%WINDIR%\WinSxS" /save "%WINDIR%\WinSxS_NTFS.acl" /t
takeown /f "%WINDIR%\WinSxS" /r
icacls "%WINDIR%\WinSxS" /grant "%USERDOMAIN%\%USERNAME%":(F) /t
rd /s /q "%WINDIR%\WinSxS\Temp" && rd /s /q "%WINDIR%\WinSxS\Backup"
icacls "%WINDIR%\WinSxS" /setowner "NT SERVICE\TrustedInstaller" /t
icacls "%WINDIR%" /restore "%WINDIR%\WinSxS_NTFS.acl"
del /f /s /q %WINDIR%\WinSxS_NTFS.acl
sc config msiserver start= demand
sc config TrustedInstaller start= demand
echo. && pause && goto WinSpclTskMgr
:DsblWindowsUpdts
Net Stop bits & Net Stop wuauserv & Net Stop appidsvc & Net Stop cryptsvc & Net Stop msiserver
Set "Dir1=%WinDir%\Downloaded Program Files" && Call Del /f /s /q %%Dir1%%\* 2>nul && Call RmDir /s /q %%Dir1%%
Set "Dir2=%WinDir%\SoftwareDistribution\Download" && Call Del /f /s /q %%Dir2%%\* 2>nul && Call RmDir /s /q %%Dir2%%
Set "Dir3=%WinDir%\SoftwareDistribution\DataStore" && Call Del /f /s /q %%Dir3%%\* 2>nul && Call RmDir /s /q %%Dir3%%
echo. && pause && goto WinSpclTskMgr
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
net file 1>NUL 2>NUL
if not '%errorlevel%' == '0' (
powershell Start-Process -FilePath "%0" -ArgumentList "%cd%" -verb runas >NUL 2>&1
exit /b
)
cd /d %1
:WinSpclTskMgr
cls
echo 1: Cleanup HDD Space^
2: NTFS Compress WinSXS^
3: Kill Rebootable Processes^
4: Restart Windows Explorer^
5: Stop+Clean Windows Updates^
6: Cleanup WinSXS Directory^
7: Exit this application && echo.
choice /n /c 1234567 /m "Select any of given tasks: "
if %errorlevel% == 1 (
SET PathsToClean=%Temp% "%ProgramFiles(x86)%"\Microsoft\Temp %WinDir%\Logs %SystemRoot%\Temp ^
%WinDir%\TempInst %SystemDrive%\OneDriveTemp %UserProfile%\Videos\AnyDesk %WinDir%\WinSXS\Temp ^
%ProgramData%\Microsoft\"Windows Defender"\Scans\History\ReportLatency\Latency
(FOR %%P IN (!PathsToClean!) DO ( ECHO %%P && RD /S /Q %%P )) 2>NUL
SET FilesToPurge=%ProgramData%\Microsoft\"Windows Defender"\Scans\mpcache-*
(FOR %%P IN (!FilesToPurge!) DO ( ECHO %%P && DEL /S /Q %%P )) 2>NUL
DEL /S /Q /F %LocalAppData%\Google\Drive\user_default\*.log && RD /S /Q %LocalAppData%\Google\Drive\user_default\TempData\
for /f "delims=" %%i in ('dir /a:d /s /b %SystemRoot%\Logs') do rd /s /q %%i
for /f "delims=" %%i in ('dir /a:d /s /b %SystemRoot%\Cache*') do rd /s /q %%i
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Logs') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Cache*') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Sys*?Logs') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b %windir%\softwaredistribution\Down*') do rd /s /q %%i
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.log
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
rd /s /q %windir%\temp & md %windir%\temp
del /f /q %userprofile%\cookies\*.*
del /f /q %userprofile%\recent\*.*
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
del /f /s /q "%userprofile%\recent\*.*"
del /s /f /q %userprofile%\Recent\*.*
del /s /f /q %SystemRoot%\Prefetch\*.*
del /s /f /q %SystemRoot%\Temp\*.*
del /s /f /q %USERPROFILE%\appdata\local\temp\*.*
del /s /f /q %windir%\system32\dllcache\*.*
rd /s /q %windir%\system32\dllcache
md %windir%\system32\dllcache
del /s /f /q "%SysteDrive%\Temp"\*.*
rd /s /q "%SysteDrive%\Temp"
md "%SysteDrive%\Temp"
del /s /f /q "%USERPROFILE%\Local Settings\History"\*.*
rd /s /q "%USERPROFILE%\Local Settings\History"
md "%USERPROFILE%\Local Settings\History"
del /s /f /q "%USERPROFILE%\Local Settings\Temporary Internet Files"\*.*
rd /s /q "%USERPROFILE%\Local Settings\Temporary Internet Files"
md "%USERPROFILE%\Local Settings\Temporary Internet Files"
del /s /f /q "%USERPROFILE%\Local Settings\Temp"\*.*
rd /s /q "%USERPROFILE%\Local Settings\Temp"
md "%USERPROFILE%\Local Settings\Temp"
del /s /f /q "%USERPROFILE%\Recent"\*.*
rd /s /q "%USERPROFILE%\Recent"
md "%USERPROFILE%\Recent"
del /s /f /q "%USERPROFILE%\Cookies"\*.*
rd /s /q "%USERPROFILE%\Cookies"
md "%USERPROFILE%\Cookies"
) else if %errorlevel% == 2 (
goto CmprsWinSXSFldr
) else if %errorlevel% == 3 (
SET CCleanerExc="C:\Program Files\CCleaner\CCleaner64.exe"
cd /d %LOCALAPPDATA%\Microsoft\OneDrive && OneDrive.exe /shutdown
TASKKILL /F /IM MsEdge.exe /IM OneDrive.exe /IM MicrosoftPhotos.exe /IM MicrosoftEdge.exe /IM MicrosoftEdgeCP.exe /IM Chrome.exe ^
/IM GoogleCrashHandler.exe /IM GoogleCrashHandler64.exe /IM MicrosoftEdgeSH.exe /IM Ccleaner64.exe /IM IDMan.exe /IM IDMBroker.exe ^
/IM IDMIntegrator64.exe /IM sublime_text.exe /IM Firefox.exe /IM AnyDesk.exe /IM Slack.exe /IM Teams.exe /IM uTorrent.exe ^
/IM PWRISOVM.exe /IM openvpn-gui.exe /IM openvpnserv.exe /IM Lightshot.exe /IM GoogleDriveSync.exe /IM RuntimeBroker.exe /IM Update.exe ^
/IM ETDCtrl.exe /IM ETDCtrlHelper.exe /IM ETDTouch.exe /IM TrayMenu.exe /IM PAStarter.exe /T
!CCleanerExc! /Auto && !CCleanerExc! /Auto && !CCleanerExc! /Registry && TIMEOUT /T -1 && TASKKILL /F /IM Ccleaner64.exe /T
) else if %errorlevel% == 4 (
taskkill /f /im explorer.exe && start /wait explorer.exe
taskkill /f /t /im conhost.exe /im cmd.exe /im bash.exe
) else if %errorlevel% == 5 (
goto DsblWindowsUpdts
) else if %errorlevel% == 6 (
goto ClnpPrgWinSXSFldr
) else if %errorlevel% == 7 (
exit /b 0
)
echo. && pause && goto WinSpclTskMgr
:CmprsWinSXSFldr
sc stop msiserver
sc stop TrustedInstaller
sc config msiserver start= disabled
sc config TrustedInstaller start= disabled
icacls "%WINDIR%\WinSxS" /save "%WINDIR%\WinSxS_NTFS.acl" /t
takeown /f "%WINDIR%\WinSxS" /r
icacls "%WINDIR%\WinSxS" /grant "%USERDOMAIN%\%USERNAME%":(F) /t
compact /s:"%WINDIR%\WinSxS" /c /a /i *
icacls "%WINDIR%\WinSxS" /setowner "NT SERVICE\TrustedInstaller" /t
icacls "%WINDIR%" /restore "%WINDIR%\WinSxS_NTFS.acl"
del /f /s /q %WINDIR%\WinSxS_NTFS.acl
sc config msiserver start= demand
sc config TrustedInstaller start= demand
echo. && pause && goto WinSpclTskMgr
:ClnpPrgWinSXSFldr
sc stop msiserver
sc stop TrustedInstaller
sc config msiserver start= disabled
sc config TrustedInstaller start= disabled
icacls "%WINDIR%\WinSxS" /save "%WINDIR%\WinSxS_NTFS.acl" /t
takeown /f "%WINDIR%\WinSxS" /r
icacls "%WINDIR%\WinSxS" /grant "%USERDOMAIN%\%USERNAME%":(F) /t
rd /s /q "%WINDIR%\WinSxS\Temp" && rd /s /q "%WINDIR%\WinSxS\Backup"
icacls "%WINDIR%\WinSxS" /setowner "NT SERVICE\TrustedInstaller" /t
icacls "%WINDIR%" /restore "%WINDIR%\WinSxS_NTFS.acl"
del /f /s /q %WINDIR%\WinSxS_NTFS.acl
sc config msiserver start= demand
sc config TrustedInstaller start= demand
echo. && pause && goto WinSpclTskMgr
:DsblWindowsUpdts
Net Stop bits & Net Stop wuauserv & Net Stop appidsvc & Net Stop cryptsvc & Net Stop msiserver
Set "Dir1=%WinDir%\Downloaded Program Files" && Call Del /f /s /q %%Dir1%%\* 2>nul && Call RmDir /s /q %%Dir1%%
Set "Dir2=%WinDir%\SoftwareDistribution\Download" && Call Del /f /s /q %%Dir2%%\* 2>nul && Call RmDir /s /q %%Dir2%%
Set "Dir3=%WinDir%\SoftwareDistribution\DataStore" && Call Del /f /s /q %%Dir3%%\* 2>nul && Call RmDir /s /q %%Dir3%%
echo. && pause && goto WinSpclTskMgr
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
net file 1>NUL 2>NUL
if not '%errorlevel%' == '0' (
powershell Start-Process -FilePath "%0" -ArgumentList "%cd%" -verb runas >NUL 2>&1
exit /b
)
cd /d %1
:WinSpclTskMgr
cls
echo 1: Cleanup HDD Space^
2: NTFS Compress WinSXS^
3: Kill Rebootable Processes^
4: Restart Windows Explorer^
5: Stop+Clean Windows Updates^
6: Cleanup WinSXS Directory^
7: Exit this application && echo.
choice /n /c 1234567 /m "Select any of given tasks: "
if %errorlevel% == 1 (
SET PathsToClean=%Temp% "%ProgramFiles(x86)%"\Microsoft\Temp %WinDir%\Logs %SystemRoot%\Temp ^
%WinDir%\TempInst %SystemDrive%\OneDriveTemp %UserProfile%\Videos\AnyDesk %WinDir%\WinSXS\Temp ^
%ProgramData%\Microsoft\"Windows Defender"\Scans\History\ReportLatency\Latency
(FOR %%P IN (!PathsToClean!) DO ( ECHO %%P && RD /S /Q %%P )) 2>NUL
SET FilesToPurge=%ProgramData%\Microsoft\"Windows Defender"\Scans\mpcache-*
(FOR %%P IN (!FilesToPurge!) DO ( ECHO %%P && DEL /S /Q %%P )) 2>NUL
DEL /S /Q /F %LocalAppData%\Google\Drive\user_default\*.log && RD /S /Q %LocalAppData%\Google\Drive\user_default\TempData\
for /f "delims=" %%i in ('dir /a:d /s /b %SystemRoot%\Logs') do rd /s /q %%i
for /f "delims=" %%i in ('dir /a:d /s /b %SystemRoot%\Cache*') do rd /s /q %%i
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Logs') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Cache*') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Sys*?Logs') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b %windir%\softwaredistribution\Down*') do rd /s /q %%i
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.log
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
rd /s /q %windir%\temp & md %windir%\temp
del /f /q %userprofile%\cookies\*.*
del /f /q %userprofile%\recent\*.*
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
del /f /s /q "%userprofile%\recent\*.*"
del /s /f /q %userprofile%\Recent\*.*
del /s /f /q %SystemRoot%\Prefetch\*.*
del /s /f /q %SystemRoot%\Temp\*.*
del /s /f /q %USERPROFILE%\appdata\local\temp\*.*
del /s /f /q %windir%\system32\dllcache\*.*
rd /s /q %windir%\system32\dllcache
md %windir%\system32\dllcache
del /s /f /q "%SysteDrive%\Temp"\*.*
rd /s /q "%SysteDrive%\Temp"
md "%SysteDrive%\Temp"
del /s /f /q "%USERPROFILE%\Local Settings\History"\*.*
rd /s /q "%USERPROFILE%\Local Settings\History"
md "%USERPROFILE%\Local Settings\History"
del /s /f /q "%USERPROFILE%\Local Settings\Temporary Internet Files"\*.*
rd /s /q "%USERPROFILE%\Local Settings\Temporary Internet Files"
md "%USERPROFILE%\Local Settings\Temporary Internet Files"
del /s /f /q "%USERPROFILE%\Local Settings\Temp"\*.*
rd /s /q "%USERPROFILE%\Local Settings\Temp"
md "%USERPROFILE%\Local Settings\Temp"
del /s /f /q "%USERPROFILE%\Recent"\*.*
rd /s /q "%USERPROFILE%\Recent"
md "%USERPROFILE%\Recent"
del /s /f /q "%USERPROFILE%\Cookies"\*.*
rd /s /q "%USERPROFILE%\Cookies"
md "%USERPROFILE%\Cookies"
) else if %errorlevel% == 2 (
goto CmprsWinSXSFldr
) else if %errorlevel% == 3 (
SET CCleanerExc="C:\Program Files\CCleaner\CCleaner64.exe"
cd /d %LOCALAPPDATA%\Microsoft\OneDrive && OneDrive.exe /shutdown
TASKKILL /F /IM MsEdge.exe /IM OneDrive.exe /IM MicrosoftPhotos.exe /IM MicrosoftEdge.exe /IM MicrosoftEdgeCP.exe /IM Chrome.exe ^
/IM GoogleCrashHandler.exe /IM GoogleCrashHandler64.exe /IM MicrosoftEdgeSH.exe /IM Ccleaner64.exe /IM IDMan.exe /IM IDMBroker.exe ^
/IM IDMIntegrator64.exe /IM sublime_text.exe /IM Firefox.exe /IM AnyDesk.exe /IM Slack.exe /IM Teams.exe /IM uTorrent.exe ^
/IM PWRISOVM.exe /IM openvpn-gui.exe /IM openvpnserv.exe /IM Lightshot.exe /IM GoogleDriveSync.exe /IM RuntimeBroker.exe /IM Update.exe ^
/IM ETDCtrl.exe /IM ETDCtrlHelper.exe /IM ETDTouch.exe /IM TrayMenu.exe /IM PAStarter.exe /T
!CCleanerExc! /Auto && !CCleanerExc! /Auto && !CCleanerExc! /Registry && TIMEOUT /T -1 && TASKKILL /F /IM Ccleaner64.exe /T
) else if %errorlevel% == 4 (
taskkill /f /im explorer.exe && start /wait explorer.exe
taskkill /f /t /im conhost.exe /im cmd.exe /im bash.exe
) else if %errorlevel% == 5 (
goto DsblWindowsUpdts
) else if %errorlevel% == 6 (
goto ClnpPrgWinSXSFldr
) else if %errorlevel% == 7 (
exit /b 0
)
echo. && pause && goto WinSpclTskMgr
:CmprsWinSXSFldr
sc stop msiserver
sc stop TrustedInstaller
sc config msiserver start= disabled
sc config TrustedInstaller start= disabled
icacls "%WINDIR%\WinSxS" /save "%WINDIR%\WinSxS_NTFS.acl" /t
takeown /f "%WINDIR%\WinSxS" /r
icacls "%WINDIR%\WinSxS" /grant "%USERDOMAIN%\%USERNAME%":(F) /t
compact /s:"%WINDIR%\WinSxS" /c /a /i *
icacls "%WINDIR%\WinSxS" /setowner "NT SERVICE\TrustedInstaller" /t
icacls "%WINDIR%" /restore "%WINDIR%\WinSxS_NTFS.acl"
del /f /s /q %WINDIR%\WinSxS_NTFS.acl
sc config msiserver start= demand
sc config TrustedInstaller start= demand
echo. && pause && goto WinSpclTskMgr
:ClnpPrgWinSXSFldr
sc stop msiserver
sc stop TrustedInstaller
sc config msiserver start= disabled
sc config TrustedInstaller start= disabled
icacls "%WINDIR%\WinSxS" /save "%WINDIR%\WinSxS_NTFS.acl" /t
takeown /f "%WINDIR%\WinSxS" /r
icacls "%WINDIR%\WinSxS" /grant "%USERDOMAIN%\%USERNAME%":(F) /t
rd /s /q "%WINDIR%\WinSxS\Temp" && rd /s /q "%WINDIR%\WinSxS\Backup"
icacls "%WINDIR%\WinSxS" /setowner "NT SERVICE\TrustedInstaller" /t
icacls "%WINDIR%" /restore "%WINDIR%\WinSxS_NTFS.acl"
del /f /s /q %WINDIR%\WinSxS_NTFS.acl
sc config msiserver start= demand
sc config TrustedInstaller start= demand
echo. && pause && goto WinSpclTskMgr
:DsblWindowsUpdts
Net Stop bits & Net Stop wuauserv & Net Stop appidsvc & Net Stop cryptsvc & Net Stop msiserver
Set "Dir1=%WinDir%\Downloaded Program Files" && Call Del /f /s /q %%Dir1%%\* 2>nul && Call RmDir /s /q %%Dir1%%
Set "Dir2=%WinDir%\SoftwareDistribution\Download" && Call Del /f /s /q %%Dir2%%\* 2>nul && Call RmDir /s /q %%Dir2%%
Set "Dir3=%WinDir%\SoftwareDistribution\DataStore" && Call Del /f /s /q %%Dir3%%\* 2>nul && Call RmDir /s /q %%Dir3%%
echo. && pause && goto WinSpclTskMgr
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
net file 1>NUL 2>NUL
if not '%errorlevel%' == '0' (
powershell Start-Process -FilePath "%0" -ArgumentList "%cd%" -verb runas >NUL 2>&1
exit /b
)
cd /d %1
:WinSpclTskMgr
cls
echo 1: Cleanup HDD Space^
2: NTFS Compress WinSXS^
3: Kill Rebootable Processes^
4: Restart Windows Explorer^
5: Stop+Clean Windows Updates^
6: Cleanup WinSXS Directory^
7: Scan the health of HDD^
8: Exit this application && echo.
choice /n /c 12345678 /m "Select any of given tasks: "
if %errorlevel% == 1 (
SET PathsToClean=%Temp% "%ProgramFiles(x86)%"\Microsoft\Temp %WinDir%\Logs %SystemRoot%\Temp ^
%WinDir%\TempInst %SystemDrive%\OneDriveTemp %UserProfile%\Videos\AnyDesk %WinDir%\WinSXS\Temp ^
%ProgramData%\Microsoft\"Windows Defender"\Scans\History\ReportLatency\Latency
(FOR %%P IN (!PathsToClean!) DO ( ECHO %%P && RD /S /Q %%P )) 2>NUL
SET FilesToPurge=%ProgramData%\Microsoft\"Windows Defender"\Scans\mpcache-*
(FOR %%P IN (!FilesToPurge!) DO ( ECHO %%P && DEL /S /Q %%P )) 2>NUL
DEL /S /Q /F %LocalAppData%\Google\Drive\user_default\*.log && RD /S /Q %LocalAppData%\Google\Drive\user_default\TempData\
for /f "delims=" %%i in ('dir /a:d /s /b %SystemRoot%\Logs') do rd /s /q %%i
for /f "delims=" %%i in ('dir /a:d /s /b %SystemRoot%\Cache*') do rd /s /q %%i
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Logs') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Cache*') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Sys*?Logs') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b %windir%\softwaredistribution\Down*') do rd /s /q %%i
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.log
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
rd /s /q %windir%\temp & md %windir%\temp
del /f /q %userprofile%\cookies\*.*
del /f /q %userprofile%\recent\*.*
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
del /f /s /q "%userprofile%\recent\*.*"
del /s /f /q %userprofile%\Recent\*.*
del /s /f /q %SystemRoot%\Prefetch\*.*
del /s /f /q %SystemRoot%\Temp\*.*
del /s /f /q %USERPROFILE%\appdata\local\temp\*.*
del /s /f /q %windir%\system32\dllcache\*.*
rd /s /q %windir%\system32\dllcache
md %windir%\system32\dllcache
del /s /f /q "%SysteDrive%\Temp"\*.*
rd /s /q "%SysteDrive%\Temp"
md "%SysteDrive%\Temp"
del /s /f /q "%USERPROFILE%\Local Settings\History"\*.*
rd /s /q "%USERPROFILE%\Local Settings\History"
md "%USERPROFILE%\Local Settings\History"
del /s /f /q "%USERPROFILE%\Local Settings\Temporary Internet Files"\*.*
rd /s /q "%USERPROFILE%\Local Settings\Temporary Internet Files"
md "%USERPROFILE%\Local Settings\Temporary Internet Files"
del /s /f /q "%USERPROFILE%\Local Settings\Temp"\*.*
rd /s /q "%USERPROFILE%\Local Settings\Temp"
md "%USERPROFILE%\Local Settings\Temp"
del /s /f /q "%USERPROFILE%\Recent"\*.*
rd /s /q "%USERPROFILE%\Recent"
md "%USERPROFILE%\Recent"
del /s /f /q "%USERPROFILE%\Cookies"\*.*
rd /s /q "%USERPROFILE%\Cookies"
md "%USERPROFILE%\Cookies"
Dism.exe /online /Cleanup-Image /SPSuperseded
Dism.exe /online /Cleanup-Image /StartComponentCleanup
Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase
CleanMgr.exe /VeryLowDisk && CleanMgr.exe /AutoClean && CleanMgr.exe /LowDisk
CleanMgr.exe /Sageset:249 && CleanMgr.exe /Sagerun:249 && CleanMgr.exe /Sagerun:249
) else if %errorlevel% == 2 (
goto CmprsWinSXSFldr
) else if %errorlevel% == 3 (
SET CCleanerExc="C:\Program Files\CCleaner\CCleaner64.exe"
cd /d %LOCALAPPDATA%\Microsoft\OneDrive && OneDrive.exe /shutdown
TASKKILL /F /IM MsEdge.exe /IM OneDrive.exe /IM MicrosoftPhotos.exe /IM MicrosoftEdge.exe /IM MicrosoftEdgeCP.exe /IM Chrome.exe ^
/IM GoogleCrashHandler.exe /IM GoogleCrashHandler64.exe /IM MicrosoftEdgeSH.exe /IM Ccleaner64.exe /IM IDMan.exe /IM IDMBroker.exe ^
/IM IDMIntegrator64.exe /IM sublime_text.exe /IM Firefox.exe /IM AnyDesk.exe /IM Slack.exe /IM Teams.exe /IM uTorrent.exe ^
/IM PWRISOVM.exe /IM openvpn-gui.exe /IM openvpnserv.exe /IM Lightshot.exe /IM GoogleDriveSync.exe /IM RuntimeBroker.exe /IM Update.exe ^
/IM ETDCtrl.exe /IM ETDCtrlHelper.exe /IM ETDTouch.exe /IM TrayMenu.exe /IM PAStarter.exe /T
!CCleanerExc! /Auto && !CCleanerExc! /Auto && !CCleanerExc! /Registry && TIMEOUT /T -1 && TASKKILL /F /IM Ccleaner64.exe /T
) else if %errorlevel% == 4 (
taskkill /f /im explorer.exe && start /wait explorer.exe
taskkill /f /t /im conhost.exe /im cmd.exe /im bash.exe
) else if %errorlevel% == 5 (
goto DsblWindowsUpdts
) else if %errorlevel% == 6 (
goto ClnpPrgWinSXSFldr
) else if %errorlevel% == 7 (
rd /s /q %temp% && rd /s /q %WinDir%\Temp && md %WinDir%\Temp && sfc /Scannow
) else if %errorlevel% == 8 (
exit /b 0
)
echo. && pause && goto WinSpclTskMgr
:CmprsWinSXSFldr
sc stop msiserver
sc stop TrustedInstaller
sc config msiserver start= disabled
sc config TrustedInstaller start= disabled
icacls "%WINDIR%\WinSxS" /save "%WINDIR%\WinSxS_NTFS.acl" /t
takeown /f "%WINDIR%\WinSxS" /r
icacls "%WINDIR%\WinSxS" /grant "%USERDOMAIN%\%USERNAME%":(F) /t
compact /s:"%WINDIR%\WinSxS" /c /a /i *
icacls "%WINDIR%\WinSxS" /setowner "NT SERVICE\TrustedInstaller" /t
icacls "%WINDIR%" /restore "%WINDIR%\WinSxS_NTFS.acl"
del /f /s /q %WINDIR%\WinSxS_NTFS.acl
sc config msiserver start= demand
sc config TrustedInstaller start= demand
echo. && pause && goto WinSpclTskMgr
:ClnpPrgWinSXSFldr
sc stop msiserver
sc stop TrustedInstaller
sc config msiserver start= disabled
sc config TrustedInstaller start= disabled
icacls "%WINDIR%\WinSxS" /save "%WINDIR%\WinSxS_NTFS.acl" /t
takeown /f "%WINDIR%\WinSxS" /r
icacls "%WINDIR%\WinSxS" /grant "%USERDOMAIN%\%USERNAME%":(F) /t
rd /s /q "%WINDIR%\WinSxS\Temp" && rd /s /q "%WINDIR%\WinSxS\Backup"
icacls "%WINDIR%\WinSxS" /setowner "NT SERVICE\TrustedInstaller" /t
icacls "%WINDIR%" /restore "%WINDIR%\WinSxS_NTFS.acl"
del /f /s /q %WINDIR%\WinSxS_NTFS.acl
sc config msiserver start= demand
sc config TrustedInstaller start= demand
echo. && pause && goto WinSpclTskMgr
:DsblWindowsUpdts
sc config bits start= disabled && net stop bits
sc config dosvc start= delayed-auto && net stop dosvc
sc config wuauserv start= disabled && net stop wuauserv
Net Stop bits & Net Stop wuauserv & Net Stop appidsvc & Net Stop cryptsvc & Net Stop msiserver
Set "Dir1=%WinDir%\Downloaded Program Files" && Call Del /f /s /q %%Dir1%%\* 2>nul && Call RmDir /s /q %%Dir1%%
Set "Dir2=%WinDir%\SoftwareDistribution\Download" && Call Del /f /s /q %%Dir2%%\* 2>nul && Call RmDir /s /q %%Dir2%%
Set "Dir3=%WinDir%\SoftwareDistribution\DataStore" && Call Del /f /s /q %%Dir3%%\* 2>nul && Call RmDir /s /q %%Dir3%%
echo. && pause && goto WinSpclTskMgr
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
net file 1>NUL 2>NUL
if not '%errorlevel%' == '0' (
powershell Start-Process -FilePath "%0" -ArgumentList "%cd%" -verb runas >NUL 2>&1
exit /b
)
cd /d %1
:WinSpclTskMgr
cls
echo 1: Cleanup HDD Space^
2: NTFS Compress WinSXS^
3: Kill Rebootable Processes^
4: Restart Windows Explorer^
5: Stop+Clean Windows Updates^
6: Cleanup WinSXS Directory^
7: Scan the health of HDD^
8: Exit this application && echo.
choice /n /c 12345678 /m "Select any of given tasks: "
if %errorlevel% == 1 (
SET PathsToClean=%Temp% "%ProgramFiles(x86)%"\Microsoft\Temp %WinDir%\Logs %SystemRoot%\Temp ^
%WinDir%\TempInst %SystemDrive%\OneDriveTemp %UserProfile%\Videos\AnyDesk %WinDir%\WinSXS\Temp ^
%ProgramData%\Microsoft\"Windows Defender"\Scans\History\ReportLatency\Latency
(FOR %%P IN (!PathsToClean!) DO ( ECHO %%P && RD /S /Q %%P )) 2>NUL
SET FilesToPurge=%ProgramData%\Microsoft\"Windows Defender"\Scans\mpcache-*
(FOR %%P IN (!FilesToPurge!) DO ( ECHO %%P && DEL /S /Q %%P )) 2>NUL
DEL /S /Q /F %LocalAppData%\Google\Drive\user_default\*.log && RD /S /Q %LocalAppData%\Google\Drive\user_default\TempData\
for /f "delims=" %%i in ('dir /a:d /s /b %SystemRoot%\Logs') do rd /s /q %%i
for /f "delims=" %%i in ('dir /a:d /s /b %SystemRoot%\Cache*') do rd /s /q %%i
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Logs') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Cache*') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b "%ProgramFiles%"\Sys*?Logs') do rd /s /q "%%i"
for /f "delims=" %%i in ('dir /a:d /s /b %windir%\softwaredistribution\Down*') do rd /s /q %%i
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.log
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
rd /s /q %windir%\temp & md %windir%\temp
del /f /q %userprofile%\cookies\*.*
del /f /q %userprofile%\recent\*.*
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
del /f /s /q "%userprofile%\recent\*.*"
del /s /f /q %userprofile%\Recent\*.*
del /s /f /q %SystemRoot%\Prefetch\*.*
del /s /f /q %SystemRoot%\Temp\*.*
del /s /f /q %USERPROFILE%\appdata\local\temp\*.*
del /s /f /q %windir%\system32\dllcache\*.*
rd /s /q %windir%\system32\dllcache
md %windir%\system32\dllcache
del /s /f /q "%SysteDrive%\Temp"\*.*
rd /s /q "%SysteDrive%\Temp"
md "%SysteDrive%\Temp"
del /s /f /q "%USERPROFILE%\Local Settings\History"\*.*
rd /s /q "%USERPROFILE%\Local Settings\History"
md "%USERPROFILE%\Local Settings\History"
del /s /f /q "%USERPROFILE%\Local Settings\Temporary Internet Files"\*.*
rd /s /q "%USERPROFILE%\Local Settings\Temporary Internet Files"
md "%USERPROFILE%\Local Settings\Temporary Internet Files"
del /s /f /q "%USERPROFILE%\Local Settings\Temp"\*.*
rd /s /q "%USERPROFILE%\Local Settings\Temp"
md "%USERPROFILE%\Local Settings\Temp"
del /s /f /q "%USERPROFILE%\Recent"\*.*
rd /s /q "%USERPROFILE%\Recent"
md "%USERPROFILE%\Recent"
del /s /f /q "%USERPROFILE%\Cookies"\*.*
rd /s /q "%USERPROFILE%\Cookies"
md "%USERPROFILE%\Cookies"
Dism.exe /online /Cleanup-Image /SPSuperseded
Dism.exe /online /Cleanup-Image /StartComponentCleanup
Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase
CleanMgr.exe /VeryLowDisk && CleanMgr.exe /AutoClean && CleanMgr.exe /LowDisk
CleanMgr.exe /Sageset:249 && CleanMgr.exe /Sagerun:249 && CleanMgr.exe /Sagerun:249
) else if %errorlevel% == 2 (
goto CmprsWinSXSFldr
) else if %errorlevel% == 3 (
SET CCleanerExc="C:\Program Files\CCleaner\CCleaner64.exe"
cd /d %LOCALAPPDATA%\Microsoft\OneDrive && OneDrive.exe /shutdown
TASKKILL /F /IM MsEdge.exe /IM OneDrive.exe /IM MicrosoftPhotos.exe /IM MicrosoftEdge.exe /IM MicrosoftEdgeCP.exe /IM Chrome.exe ^
/IM GoogleCrashHandler.exe /IM GoogleCrashHandler64.exe /IM MicrosoftEdgeSH.exe /IM Ccleaner64.exe /IM IDMan.exe /IM IDMBroker.exe ^
/IM IDMIntegrator64.exe /IM sublime_text.exe /IM Firefox.exe /IM AnyDesk.exe /IM Slack.exe /IM Teams.exe /IM uTorrent.exe ^
/IM PWRISOVM.exe /IM openvpn-gui.exe /IM openvpnserv.exe /IM Lightshot.exe /IM GoogleDriveSync.exe /IM RuntimeBroker.exe /IM Update.exe ^
/IM ETDCtrl.exe /IM ETDCtrlHelper.exe /IM ETDTouch.exe /IM TrayMenu.exe /IM PAStarter.exe /T
!CCleanerExc! /Auto && !CCleanerExc! /Auto && !CCleanerExc! /Registry && TIMEOUT /T -1 && TASKKILL /F /IM Ccleaner64.exe /T
) else if %errorlevel% == 4 (
taskkill /f /im explorer.exe && start /wait explorer.exe
taskkill /f /t /im conhost.exe /im cmd.exe /im bash.exe
) else if %errorlevel% == 5 (
goto DsblWindowsUpdts
) else if %errorlevel% == 6 (
goto ClnpPrgWinSXSFldr
) else if %errorlevel% == 7 (
rd /s /q %temp% && rd /s /q %WinDir%\Temp && md %WinDir%\Temp && sfc /Scannow
) else if %errorlevel% == 8 (
exit /b 0
)
echo. && pause && goto WinSpclTskMgr
:CmprsWinSXSFldr
sc stop msiserver
sc stop TrustedInstaller
sc config msiserver start= disabled
sc config TrustedInstaller start= disabled
icacls "%WINDIR%\WinSxS" /save "%WINDIR%\WinSxS_NTFS.acl" /t
takeown /f "%WINDIR%\WinSxS" /r
icacls "%WINDIR%\WinSxS" /grant "%USERDOMAIN%\%USERNAME%":(F) /t
compact /s:"%WINDIR%\WinSxS" /c /a /i *
icacls "%WINDIR%\WinSxS" /setowner "NT SERVICE\TrustedInstaller" /t
icacls "%WINDIR%" /restore "%WINDIR%\WinSxS_NTFS.acl"
del /f /s /q %WINDIR%\WinSxS_NTFS.acl
sc config msiserver start= demand
sc config TrustedInstaller start= demand
echo. && pause && goto WinSpclTskMgr
:ClnpPrgWinSXSFldr
sc stop msiserver
sc stop TrustedInstaller
sc config msiserver start= disabled
sc config TrustedInstaller start= disabled
icacls "%WINDIR%\WinSxS" /save "%WINDIR%\WinSxS_NTFS.acl" /t
takeown /f "%WINDIR%\WinSxS" /r
icacls "%WINDIR%\WinSxS" /grant "%USERDOMAIN%\%USERNAME%":(F) /t
rd /s /q "%WINDIR%\WinSxS\Temp" && rd /s /q "%WINDIR%\WinSxS\Backup"
icacls "%WINDIR%\WinSxS" /setowner "NT SERVICE\TrustedInstaller" /t
icacls "%WINDIR%" /restore "%WINDIR%\WinSxS_NTFS.acl"
del /f /s /q %WINDIR%\WinSxS_NTFS.acl
sc config msiserver start= demand
sc config TrustedInstaller start= demand
echo. && pause && goto WinSpclTskMgr
:DsblWindowsUpdts
sc config bits start= disabled && net stop bits
sc config dosvc start= delayed-auto && net stop dosvc
sc config wuauserv start= disabled && net stop wuauserv
Net Stop bits & Net Stop wuauserv & Net Stop appidsvc & Net Stop cryptsvc & Net Stop msiserver
Set "Dir1=%WinDir%\Downloaded Program Files" && Call Del /f /s /q %%Dir1%%\* 2>nul && Call RmDir /s /q %%Dir1%%
Set "Dir2=%WinDir%\SoftwareDistribution\Download" && Call Del /f /s /q %%Dir2%%\* 2>nul && Call RmDir /s /q %%Dir2%%
Set "Dir3=%WinDir%\SoftwareDistribution\DataStore" && Call Del /f /s /q %%Dir3%%\* 2>nul && Call RmDir /s /q %%Dir3%%
echo. && pause && goto WinSpclTskMgr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment