REFINED SHUTDOWN BATCH ▀ THE REMOVAL OF ALL FILES LOCATED IN THE TEMP FOLDER HAS BEEN ADDED

REFINED SHUTDOWN BATCH ▀ THE REMOVAL OF ALL FILES LOCATED IN THE TEMP FOLDER HAS BEEN ADDED

Shutting down computer without actually doing something useful is quite lame.
So i’ve decided to implement a nice addition in the face of junk removal.

@echo off
echo Cleaning up temporary files in %TEMP% folder...
echo.

set "tempfolder=%TEMP%"

cd /d "%tempfolder%"

:: Delete all files and folders in TEMP (including read-only and hidden)
del /q /f /s *.* >nul 2>&1
for /d %%x in (*) do rd /s /q "%%x" >nul 2>&1

echo.
echo Temporary files deleted successfully.
echo Initiating system shutdown...

shutdown /s /t 0

I am currently working on a website dedicated solely to code snippets. You will see a spin-off project of mine somewhere in the summer.