Windows and third-party software use temporary files to store data for a, well, temporary amount of time. Programs create these short-lived files for all kinds of purposes. And although they’re supposed to be temporary, many programs don’t delete temp files they’ve created when they’re no longer needed. Therefore, these so-called “temporary” files can accumulate on your PC’s hard drive.

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.

  1. Click the magnifying glass taskbar icon for opening Windows 11’s search tool.
  2. Enter the keyword Storage Sense in the search box.
  3. Select Turn on Storage Sense in the search results.
  4. Click the Storage Sense toggle switch on.
    The Storage Sense toggle switch
  5. Then click the > arrow on the Storage Sense option to bring up the settings directly below.
    The temporary file cleaner in Settings
  6. Select the Keep Windows running smoothly by automatically clearing up temporary system and app files checkbox.
  7. Turn on the Automatic User Cleanup content option.
  8. Click the Run Storage Sense drop-down menu to select an automatic cleanup schedule for deleting temporary files. Select the Every day option for the most regular scheduling.
  9. To manually delete temporary files with Storage Sense, press the Run Storage Sense now button.
    The Run Storage Sense now button
 

READ ALSO:Automatically Free Up Disk Space With Windows 10 Storage Sense

 

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.

  1. Press Start on your taskbar and click Settings on the menu.
  2. Select Storage on the System tab.
  3. Click Temporary files to bring up the cleaner tool shown directly below.
    The temporary file cleaner in Settings
  4. 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.
  5. Press the Remove files button.
 

READ ALSO:How To Save Space With Windows 10’S New Disk Cleanup Tool

 

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.

  1. Press Win + S, then type cmd in the search text box that opens.
  2. Right-click Command Prompt in the search results to select a Run as administrator option on its context menu.
  3. Type in the command below and press Enter:
del /q/f/s %TEMP%\* 
 

The delete temporary files command4. 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.

 
  1. Open Windows 11’s search box on the taskbar.
  2. Input Disk Cleanup within the search box.
  3. Click Disk Clean-up in the search results to open it.
  4. Press the Clean up system files button.
    The Clean up system files button
  5. Select the Temporary Files, Temporary Internet Files, and Windows Update Clean-up files. Alternatively, you can just select all the checkbox options there.
    disk-clean-up-window
  6. Click the OK button.
  7. 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.

  1. Open the Start menu, and select All apps.
  2. Next, select Notepad on the Start menu’s app list.
  3. Then copy the batch file code below with the Ctrl + C hotkey.
    rd %temp% /s /q
    md %temp%
  4. Paste that code into Notepad by pressing the Ctrl + V keyboard shortcut.
    A batch file for deleting temporary files
  5. Select the File menu option.
  6. Click Save as on the menu.
  7. Select the All files option on the Save as type drop-down menu.
  8. Enter Delete Temporary Data.bat in the File name box.
    The Save As window button
  9. Select the Desktop location.
  10. Click the Save option.
  11. 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.

  1. Right-click the Delete Temporary Data batch file on the desktop and select the Copy option.
  2. Launch Run (it has a Windows + R hotkey).
  3. Type %appdata%\microsoft\windows\start menu\programs\startup\ in the Open box, and click the OK option.
  4. Then press the Ctrl + V hotkey to paste the batch file into the startup folder.
The Start-up folder 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.

  1. Bring up Run with Win + R.
  2. Type %Temp% in Run, and click the OK button.
  3. Press the Ctrl + A hotkey to select all content within the Temp folder
    The Temp folder
  4. Then click the Delete button on the command bar.
  5. A dialog box might pop up that tells you an action can’t be complete 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.
 
File In Use window

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.

The Recycle Bin

READ ALSO:Delete These Windows Files And Folders To Free Up Disk Space

 

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.