Introduction
In this lesson, we’ll make a single BAT file that will delete all of our temporary data. We may remove all data from this file with a single click, eliminating the requirement to use the RUN command.
Follow these procedures to create this file:
Step 1: Launch Notepad and create a new file.
Step 2: Paste the code below into this file.
del /q "C:\Windows\Temp\*" FOR /D %%p IN ("C:\Windows\Temp\*.*") DO rmdir "%%p" /s /q del /q "*" FOR /D %%p IN ("*.*") DO rmdir "%%p" /s /q del /q "C:\Windows\Prefetch\*" FOR /D %%p IN ("C:\Windows\Prefetch\*.*") DO rmdir "%%p" /s /q
Step 3: After adding the above code, launch file explorer
Step 4: Now, launch the RUN command from the Start menu, or use the shortcut key for that window key + R
In this box write command : %temp%
and press Enter Key
This command will open a transient folder on your C disc.
Step 5:Copy the path to this folder and paste it into the Notepad file.
Note: Remember to put that path before the ‘*’ in the file.
Step 6: Save this file as .bat file like below :
That’s it
When you wish to remove all temp data from temp and prefetch, double-click on this file for a run this file, and this file will clean all temp data.
Output