How to Delete Temporary Files in Windows 10 via Command Prompt?

Can users delete temporary files in Windows using Command Prompt? In this post, you’ll learn how to use CMD to clean temp files and a handy tool to quickly and completely do this.

Lucas

By Lucas / Updated on May 12, 2023

Share this: instagram reddit

What are temporary files on PC?

Temporary files are produced in the Windows operating system by both the OS and the apps running on your computer.

Many of Windows' temporary files have the file extension ".tmp" or are preceded by a tilde. The majority of temporary files produced end up in the Windows Temp folder.

The only distinction between temporary files and virtual memory is that temporary files are more focused than virtual memory and serve a single program. The location of transient files changes depending on the software and operating system. However, in Windows, the files directory is often saved on the C drive so that the system can immediately retrieve these files to ensure that your OS and running programs are working properly.

For example, when a user browses a website, cookies will build a temporary file to store the user's identification and other information to optimize the access speed of our later login to the website.

Is it safe to delete temporary files?

A temporary file's function is to hold temporary information so that the job may be read while it is running to decrease the loading time, and it cannot determine the task's execution. They are rendered ineffective once their service is over.

Temporary files will take up a lot of disk space and slow down Windows performance if users don't regularly delete them. So, it’s necessary to delete temporary files to free up disk space and keep Windows healthy.

How to delete temporary files Windows 10 Command Prompt?

cmd.exe is a text-based user interface screen that provides an input field for an operating system or application. It is an executable CLI application that runs the command prompt. At the command line, users input a statement that includes a basic batch file or command name as well as any parameters to describe the program's operating circumstances, logging, and so on. Then the prompt is intended to generate a response.

If you type the correct commands and perform them, you can change some system settings and make your PC performance improve.

To delete temporary files in Windows 10 with Command Prompt, you can follow the steps we show in this part.

Step 1. Open “CMD” or “Command Prompt” from either the “Start” menu or by entering the code “cmd” in the Run Dialog Box and then pressing the “Enter” key from the keyboard.

Open Run Dialogue

Step 2. In the CMD window, write down the command “del /q/f/s %TEMP%\*” and press Enter.

/q performs the operation without prompting for confirmation
/f ignores the read-only attribute and forces deletion
/s deletes content from all subfolders

CMD delete temp files

Note: Temporary files removed through the command prompt are not transferred to the Recycle Bin. That is to say, the temporary files cannot be retrieved. As a result, if you intend to remove any files using Command Prompt, please exercise caution.

Cannot delete temporary Internet files in Windows 10

Although the temporary files can be deleted by CMD, some users find that after deleting temporary files via CMD, some Internet temporary files are still on the disk and occupy some GBs space.

Why can't transient internet files be deleted?

To begin with, because temporary internet files are not the same as temporary files, we cannot remove these files straight from the PC. And when the approaches are incorrect, these temporary internet files cannot be effectively erased.

To completely delete Internet temp files, you can use Control Panel.

Steps 1. Select Control Panel in the Start menu, and click "Network and Internet" and "Internet Options" in order.

Step 2. In the "Internet Properties" window that pops up, tick "Delete browsing history on exit". Click "Settings" and set the website file data.

Delete Internet temp files in Control Panel

How to delete temporary files (Deeply & Safely)?

You see, if you only use CMD to delete temporary files, some Internet temp files are still on your disk and take up free space. Is there any method that allows you to delete all temp files at one time?

Well, to get rid of this problem, we recommend you AOMEI Partition Assistant Standard, a free disk and partition manager for Windows 11/10/8/8.1/7XP systems to conveniently manage their devices.

This software can not only fully analyze and eliminate all temporary files from your computer, but it can also detect other junk files like system junk files, registry junk files and cache files, which cause troubles for many Windows users. With a few easy clicks, you can free up space on your computer.

Download FreewareWin 11/10/8.1/8/7/XP
Secure Download

Step 1. Click "Free up" and "PC Cleaner" at the top menu.

PC Cleaner

Step 2. Then, click "Start Scan" in the new pop-up window.

Start Scan

Step 3. After that, you can see temp files under System Junk Files. Tick it and click “Clean All” to delete it.

After scanning

Step 4. When you see a correct symbol displayed in the interface, you can click "Back" to leave the function.

Cleanup finished

★Tips: If you upgrade to the Professional Edition, you can:
 Move installed programs to another location without reinstalling them to release more free space from the C drive or the system disk.
 Extend C drive space if there is more than one partition on the system disk.
 Scan and delete large files from the deep storage location on your PC.

To sum up

This is how to delete temporary files in Windows 10 via Command Prompt. If you want to know detailed steps about how to delete temporary files in Windows 10 using CMD, then this post will help you.

If you wish to deeply clean all junk files on your PC, AOMEI Partition Assistant is a great tool. And besides the functions we’ve mentioned, this tool can also convert a disk to MBR/GPT without deleting any partitions, cloning disks, migrating OS only to quickly set up a new computer, and so on.

In addition, there is the Server Edition for Windows Server 2022/2019/2016/2012(R2)/2008(R2)/2003 users to easily manage their Server PCs.

Lucas
Lucas · Staff Editor
I prefer peaceful and quiet life during vacation,but sometimes I watch football match if my favorite club performs brilliantly in that season. And I love reading, painting and calligraphy, thus I send my friends festival handwriting cards every year.