How to Delete Temporary Internet Files Command Line

By | July 20, 2018

How to Delete Temporary Internet Files Command-Line or Command Prompt Easily. Generally, all temporary internet files are located on the user account on Windows. If you wanna delete all internet files, just follow by command line.
How to Delete Temporary Internet Files Command Line

How to Delete Temporary Internet Files on Windows 7 –

If you are a Windows 7 user, just follow some steps below –
We know normally internet temporary files are stored in the folder AppData\Local\Temporary Internet Files. Now, you need to delete these files, so you need to take ownership of the folder and its files. Just run the command below –

takeown  /R /F  "%userprofile%\AppData\Local\Temporary Internet Files"

Need to take ownership of this file for detailed information on this command.

Read Also: How to Run Command Prompt as an Administrator

Once you open the folder in Explorer and just delete the files. You need to run the below command.

By this command delete the files in the folder.

del "%userprofile%\AppData\Local\Temporary Internet Files\*"

By this command to delete the subfolders in Temporary Internet Files.

forfiles /P "%userprofile%\AppData\Local\Temporary Internet Files\*" /C "cmd /c if @isdir==TRUE rmdir /S /Q @file"

If you delete the whole directory, you need to use just the above two commands only. But keep the root folder untouched.

Read Also: How to Create Unique Named File From Batch Script

How to delete application temporary files –

For Windows 7, all various applications of temporary files keep in the located folder AppData\Local\Temp. If you want to delete this cache, just run the below command.

del %userprofile%\AppData\Local\Temp\*
forfiles /P %userprofile%\AppData\Local\Temp\ /C "cmd /c if @isdir==TRUE rmdir /S /Q @file"

You can also verify to points in this folder that the environment variables TEMP or TMP.

c:\>set t
TEMP=C:\Users\loginId\AppData\Local\Temp
TMP=C:\Users\loginId\AppData\Local\Temp

So, deletion of temp files can also use by the below command.

del %TEMP%\*
forfiles /P %TEMP%\* /C "cmd /c if @isdir==TRUE rmdir /S /Q @file"

Read Also: How to Reboot Windows from PowerShell

Leave a Reply

Your email address will not be published. Required fields are marked *