To quickly clean up the C drive on Windows 10 using CMD, you can utilize the Disk Cleanup utility by executing the following command in the Command Prompt.
cleanmgr /sagerun:1
Understanding CMD
What is CMD?
Command Prompt (CMD) is a command-line interpreter available in Windows operating systems. It allows users to perform various tasks directly using textual commands instead of through graphical interfaces. This tool can execute batch files, automate processes, and provide a more granular level of control over the system.
Why Use CMD for Cleanup?
Using CMD for cleanup on the C Drive in Windows 10 offers several advantages over traditional GUI methods. CMD commands often run faster, especially when dealing with large volumes of files or directories. Additionally, executing commands through CMD can be less cumbersome, particularly when automating repetitive tasks.

Preparing for Cleanup
Backup Important Data
Before you begin any cleanup process, it is crucial to back up important data. This precaution ensures that even if something goes wrong during the cleanup, your vital files remain secure. You can use Windows' built-in File History feature, an external hard drive, or cloud storage services for your backups. Always check that your backup was successful before proceeding with any system cleanup.
Open Command Prompt
To open Command Prompt in Windows 10, follow these simple steps:
- Press the Windows key and type "cmd."
- Right-click on the Command Prompt option and select "Run as administrator" for elevated privileges. Running CMD as an administrator allows you to execute commands that affect system files and settings.

Cleaning Up C Drive Using CMD
Identifying Storage Issues
Using the `dir` Command
First, it’s important to assess which directories and files are taking up the most space on your C Drive. The `dir` command can help you identify these files.
To use the command, type the following into your Command Prompt:
dir C:\ /s
This command displays a list of files and directories within your C Drive, including subdirectories, allowing you to monitor the space each uses. Pay attention to the total file size reported at the end of the output to understand your storage situation better.
Cleaning Temporary Files
Utilizing the `del` Command
Temporary files can accumulate over time and consume valuable space. You can delete these files using the `del` command.
To remove temporary files in your temporary directory, run the following command:
del /q/f/s %TEMP%\*
- /q: Enables quiet mode; does not ask for confirmation
- /f: Forces deletion of read-only files
- /s: Deletes specified files from all subdirectories
This command cleans out the temporary files that usually clutter the system.
Accessing the Windows Temp Folder
You can also navigate directly to the Windows Temp folder and delete files with a simple command. To do this, first navigate to the directory:
cd C:\Windows\Temp
Once in this folder, you can delete the files using:
del *.* /q
This command clears all files in the Temp folder without requiring confirmation.
Disk Cleanup via CMD
Running the Built-in Disk Cleanup Utility
For a more thorough cleanup, you can utilize the built-in Disk Cleanup utility via Command Prompt. To run this utility, enter the following command:
cleanmgr /sagerun:1
This command launches the Disk Cleanup tool with predefined settings, allowing you to select which file types to delete, such as system files, temporary files, and Recycle Bin contents.
Removing Unused Files and Folders
Using the `rmdir` Command
If you have directories that are no longer needed, you can remove them using the `rmdir` command. To delete a directory and all its contents, type:
rmdir /s /q "C:\Path\To\Folder"
- /s: Removes all directories and files in the specified directory
- /q: Runs the command in quiet mode
Be cautious with this command, as it permanently deletes folders and their contents.
Clearing Browser Cache (For users of Edge and IE)
Sometimes, the browser cache can take a significant amount of space. You can directly remove it for Microsoft Edge and Internet Explorer with:
rd /s /q "%localappdata%\Microsoft\Windows\INetCache"
This command effectively wipes the cache, often resulting in regained disk space and improved browser performance.

Advanced Cleanup Techniques
Using Windows Management Instrumentation Command-line (WMIC)
For more advanced users, WMIC can be a powerful tool to identify large files taking up space. To list files over a specific size, you can use this command:
wmic datafile where "drive='C:'" get name,size
This command retrieves all files on the C Drive, listing their names and sizes. You can customize the command further to filter results based on specific criteria.
Automating Cleanup with Batch Files
If you want to create a routine cleanup process, consider automating these tasks using a batch file. Open a text editor, input the following example of a cleanup script:
@echo off
del /q/f/s %TEMP%\*
del /q/f/s "%localappdata%\Microsoft\Windows\INetCache\*.*"
rmdir /s /q "C:\Path\To\Folder"
Save the file with a `.bat` extension, and you can execute this batch script with a simple double-click or by scheduling it through Task Scheduler for automated cleanup.

Conclusion
Using CMD to clean up your C Drive in Windows 10 is an efficient way to enhance your system's performance and free up valuable disk space. Utilizing commands like `del`, `rmdir`, and integrated utilities can lead to a significant improvement in your system's organization. Regular maintenance via these commands can keep your system running smoothly and efficiently.
Commit to practicing these commands, and you’ll soon master the art of using CMD for effective system cleanup.