-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathClean_Temporary_Files-v1.bat
More file actions
51 lines (41 loc) · 1.91 KB
/
Copy pathClean_Temporary_Files-v1.bat
File metadata and controls
51 lines (41 loc) · 1.91 KB
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
@echo off
REM @echo off -> Turn command echoing OFF so the commands themselves are not printed.
REM The leading @ hides the echo command itself from being shown.
@echo
REM @echo -> Without anything after it, this checks echo status instead of printing a blank line.
REM It shows "ECHO is off." because echoing was turned off earlier with @echo off.
REM To print a blank line, use echo. instead.
@echo.
@echo.
REM @echo. -> Prints a blank line on the console.
REM The dot ensures it doesn’t show "ECHO is off/on" — it's just used for spacing in output.
@echo Cache Cleaner by Sagar_Biswas
REM Show a simple title.
set /p confirm=Delete All Temporary Files? (Y/n)
REM set /p -> Prompts the user for input and stores it in the confirm variable.
if /I "%confirm%"=="" set confirm=Y
REM /I -> Compares strings case-insensitively.
REM If the user just presses Enter (empty input), it sets confirm to 'Y' by default.
if /I "%confirm%" NEQ "Y" goto end
REM If confirm is not 'Y', it jumps to the :end label to skip deletion.
REM if the user confirmed, proceed to delete temp files
color 2
echo Deleting temporary files...
REM Delete temporary files from various common temp directories.
Del /S /F /Q %temp% 2>nul
REM /S -> Deletes files from all subdirectories.
REM /F -> Forces deletion of read-only files.
REM /Q -> Quiet mode, no prompts for confirmation.
REM %temp% -> Uses the %temp% environment variable to target the user's temp directory.
REM 2>nul -> Redirects error messages to nul (ignores them).
REM Delete temp files from Windows Temp and Prefetch directories, and user temp directory.
Del /S /F /Q %Windir%\Temp 2>nul
Del /S /F /Q C:\WINDOWS\Prefetch 2>nul
Del /S /F /Q "%USERPROFILE%\AppData\Local\Temp" 2>nul
@echo.
@echo All Temporary Files Successfully Deleted!
@echo.
:end
REM :end -> Label to mark the end of the script or a section.
pause
REM pause -> Wait for user to press a key so they can read the result.