How to Auto Delete Temp Files on Windows 11 after startup
rd %temp% /s /q
Thus, leftover temporary files might be wasting quite a bit of storage space on your hard drive. Here are six methods for deleting temporary data in Windows 11.
1. How to Automatically Delete Temporary Files With Storage Sense
Windows 11 includes a Storage Sense feature that automatically eradicates temporary system and app files. So, enabling that feature can save you manually deleting such files. You can activate that feature like this.
- Click the magnifying glass taskbar icon for opening Windows 11’s search tool.
- Enter the keyword Storage Sense in the search box.
- Select Turn on Storage Sense in the search results.
- Click the Storage Sense toggle switch on.
- Then click the > arrow on the Storage Sense option to bring up the settings directly below.
- Select the Keep Windows running smoothly by automatically clearing up a temporary system and app files checkbox.
- Turn on the Automatic User Cleanup content option.
- Click the Run Storage Sense drop-down menu to select an automatic cleanup schedule for deleting temporary files. Select the Everyday option for the most regular scheduling.
- To manually delete temporary files with Storage Sense, press the Run Storage Sense now button.
2. How to Delete Temporary Files via the Settings App
The Settings app also includes a handy dedicated temporary file cleaner tool. With that utility, you can select to erase specific temporary file categories. Therefore, it gives you more control over the temporary file cleanup process than Storage Sense. This is how you can delete temp data with that temporary file cleaner.
- Press Start on your taskbar and click Settings on the menu.
- Select Storage on the System tab.
- Click Temporary files to bring up the cleaner tool shown directly below.
- To free up the most disk space, select all the temporary file checkboxes. However, selecting the Windows Update Clean-up option alone can free up gigabytes of space.
- Press the Remove files button.
3. How to Erase Temporary Files via Command Prompt
The Command Prompt interpreter has many useful tools. You can erase temporary data by entering a quick command into the Prompt’s window. These are the four steps for deleting temp files via the Command Prompt.
- Press Win + S, then type cmd in the search text box that opens.
- Right-click Command Prompt in the search results to select a Run as administrator option on its context menu.
- Type in the command below and press Enter:
del /q/f/s %TEMP%\*
4. How to Delete Temporary Files With Disk Cleanup
Disk Cleanup is the built-in cleanup tool within Windows platforms. You can erase temporary files and much more superfluous data with that utility. For instance, Disk Cleanup also includes checkbox options for clearing Recycle Bin, delivery optimization, language resource, log, and Microsoft Defender files. This is how you can delete temporary files with Disk Cleanup in Windows 11.
- Open Windows 11’s search box on the taskbar.
- Input Disk Cleanup within the search box.
- Click Disk Clean-up in the search results to open it.
- Press the Clean up system files button.
- Select the Temporary Files, Temporary Internet Files, and Windows Update Clean-up files. Alternatively, you can just select all the checkbox options there.
- Click the OK button.
- Select the Delete Files option.
5. How to Delete Temporary Files With a Batch File
Batch files incorporate a collection of commands to carry out. You can set up batch files to do many things, and that includes erasing temporary files. To set up a batch file for deleting temp data, follow these steps.
- Open the Start menu, and select All apps.
- Next, select Notepad on the Start menu’s app list.
- Then copy the batch file code below with the Ctrl + C hotkey.
rd %temp% /s /q
- Paste that code into Notepad by pressing the Ctrl + V keyboard shortcut.
- Select the File menu option.
- Click Save as on the menu.
- Select the All files option on the Save as type drop-down menu.
- Enter Delete Temporary Data.bat in the File name box.
- Select the Desktop location.
- Click the Save option.
- Thereafter, double-click the Delete Temporary Data batch file on your desktop.
Now you can click that batch file on your desktop to erase temporary files whenever needed. You can also add that batch file to the startup so that it runs automatically. To do so, copy that file into the startup folder as follows.
- Right-click the Delete Temporary Data batch file on the desktop and select the Copy option.
- Launch Run (it has a Windows + R hotkey).
- Type %appdata%\microsoft\windows\start menu\programs\startup\ in the Open box, and click the OK option.
- Then press the Ctrl + V hotkey to paste the batch file into the startup folder.
6. How to Manually Clear the Temp Folder
The Temp folder is the one that includes many of the temporary files on your PC. You can manually erase the data in that folder via File Explorer. That’s quite a quick method, and this is how you can manually delete the Temp folder’s contents.
- Bring up Run with Win + R.
- Type %Temp% in Run, and click the OK button.
- Press the Ctrl + A hotkey to select all content within the Temp folder
- Then click the Delete button on the command bar.
- A dialog box might pop up that tells you an action can’t be completed because a temporary file is in use. Select the Do this for all current items checkbox on that dialog box, and click the Skip button.
The temporary files you erase with this method could end up in the Recycle Bin. To clear that bin, double-click its desktop icon. Then select the Empty Recycle Bin option.
Eradicate Temporary Files to Free Up Hard Drive Space
Now you can win back some hard drive space from pesky temporary files. You might be able to free up gigabytes of storage space for more software by erasing temporary data with the alternative Windows 11 methods above. Nor do you need any third-party disk cleaner utility to delete such data. So, don’t let temp files waste drive space on your PC any longer.