Skip to content

Instantly share code, notes, and snippets.

@vivek1986
Forked from tuantmb/clean_cache_teams.cmd
Created July 27, 2023 22:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vivek1986/9e4dfca1c70209e1edfa2a4391131cf6 to your computer and use it in GitHub Desktop.
Save vivek1986/9e4dfca1c70209e1edfa2a4391131cf6 to your computer and use it in GitHub Desktop.
A simple batch script to clean up #cache for #Microsoft #teams
@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