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 July 11, 2025

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 for Cleanup, a free disk and partition manager for Windows 11/10/8/8.1/7/XP 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.

AOMEI Partition Assistant for Cleanup

Free Up Disk Space To Keep Your PC Running Smoothly and Efficiently

Step 1. Initiate Clean Junk Files. Install and launch AOMEI Partition Assistant for Cleanup. Click the "Clean Junk Files" tab.

Clean Junk Files

Step 2. Start scan junk files. Click the "Scan Now" button to start the process of scanning junk files.

Scan Now

Step 3. After the scan process is finished. All system junk files (including recycle bin files, temporary files, log files, invalid shortcuts, and so on) and registry junk files (including DLL registry, system registry, and program registry) will be displayed.

Listed Junk Files

Step 4. You can also click the button behind to view the junk files details.

View Junk Files Details

Step 5. And, you can click the button behind to locate the file.

Locate Junk Files

Step 6. Select junk files to start cleanup. By default, the program will select some junk files to clean up, for example, temporary files, log files, and so on. You can also manually check to select more or uncheck to deselect fewer listed junk files. Or, click "Select All" to select all junk files to clean up if you need to clean up all.

After selecting junk files that are not needed anymore, you can click the "Clean Now"button to start the cleanup.

Clean Now

Step 7. Cleanup completed. The process of the cleanup might take time, and the selected files will be cleaned up. After the process is finished, you will get a cleanup completed window displaying how many files you have cleaned and not yet cleaned.

Clean Completed

★Tips:
 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 for Cleanup is a great tool. In addition, this tool also supports Windows Server 2025/2022/2019/2016/2012(R2) 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.