Created
February 13, 2020 01:38
-
-
Save tuantmb/055428969a433e8fb13d18e10c01f285 to your computer and use it in GitHub Desktop.
A simple batch script to clean up #cache for #Microsoft #teams
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
goto:main | |
[+] Description: a simple script to clean up Microsoft Team's Cache (release a bit memory) | |
:main | |
taskkill /f /t /fi "IMAGENAME eq teams.exe" | |
echo "[x] Microsoft Team Processes were closed!!!!" | |
del /f /q "%appdata%\Microsoft\teams\application cache\cache\*.*" > nul 2>&1 | |
del /f /q "%appdata%\Microsoft\teams\blob_storage\*.*" > nul 2>&1 | |
del /f /q "%appdata%\Microsoft\teams\databases\*.*" > nul 2>&1 | |
del /f /q "%appdata%\Microsoft\teams\GPUcache\*.*" > nul 2>&1 | |
del /f /q "%appdata%\Microsoft\teams\IndexdDB\*.db" > nul 2>&1 | |
del /f /q "%appdata%\Microsoft\teams\Local Storage\*.*" > nul 2>&1 | |
del /f /q "%appdata%\Microsoft\teams\tmp\*.*" > nul 2>&1 | |
echo "[+] Microsoft Team's Cache was cleaned!!!" | |
C:\Users\%USERNAME%\AppData\Local\Microsoft\Teams\Update.exe --processStart Teams.exe | |
echo "[+] Microsoft Team Started!!!" | |
echo "DONE" |
@obrigado2020 Ofcourse it won't, because it lacks a very important switch /s
which cleans the subfolders and their contents along with.
Here is the updated code that does it:
@echo off && setlocal
:checkPrivileges
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' (
goto mainScript
) else (
goto getPrivileges
)
::-------------------------------------------------------------------------------------------------
:getPrivileges
if '%1'=='ELEV' (shift & goto mainScript)
echo.
echo Selbstausfuehrung mit Administratorrechten...
setlocal DisableDelayedExpansion
set "batchPath=%~0"
setlocal EnableDelayedExpansion
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\runAsAdmin.vbs"
echo UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\runAsAdmin.vbs"
"%temp%\runAsAdmin.vbs"
exit /B
::-------------------------------------------------------------------------------------------------
:mainScript
echo "[+] Description: Microsoft Teams Cleaner tool"
taskkill /f /t /fi "IMAGENAME eq teams.exe"
echo "[x] Microsoft Team Processes were closed!!!!"
del /f /s /q "%appdata%\Microsoft\teams\*.log" > nul 2>&1
del /f /s /q "%appdata%\Microsoft\teams\application cache\cache\*.*" > nul 2>&1
del /f /s /q "%appdata%\Microsoft\teams\blob_storage\*.*" > nul 2>&1
del /f /s /q "%appdata%\Microsoft\teams\databases\*.*" > nul 2>&1
del /f /s /q "%appdata%\Microsoft\teams\Cache\*.*" > nul 2>&1
del /f /s /q "%appdata%\Microsoft\teams\GPUcache\*.*" > nul 2>&1
del /f /s /q "%appdata%\Microsoft\teams\Code Cache\*.*" > nul 2>&1
del /f /s /q "%appdata%\Microsoft\teams\Service Worker\ScriptCache\*.*" > nul 2>&1
del /f /s /q "%appdata%\Microsoft\teams\Service Worker\CacheStorage\*.*" > nul 2>&1
del /f /s /q "%appdata%\Microsoft\teams\IndexdDB\*.db" > nul 2>&1
del /f /s /q "%appdata%\Microsoft\teams\Local Storage\*.*" > nul 2>&1
del /f /s /q "%appdata%\Microsoft\teams\tmp\*.*" > nul 2>&1
echo "[+] Microsoft Team's Cache was cleaned!!!"
:: %LOCALAPPDATA%\Microsoft\Teams\Update.exe --processStart Teams.exe
:: echo "[+] Microsoft Team Started!!!"
echo "DONE" && pause>nul
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The commands do not delete subfolders (or the subfolder contents) in these folders.