How to Clean Your Windows PC Using Command Prompt - The Talent500 Blog (2024)

If your Windows PC runs low on storage space, clean out the junk using these fast Command Prompt utilities.

Keeping your computer free from clutter can help improve performance and free up tons of storage space. Windows comes with several built-in system cleanup utilities, such as the Disk Cleanup tool. However, one lesser-known way to clean your computer is via the Command Prompt.

Here are a few ways to clean up a slow Windows computer using Command Prompt.

The Disk Cleanup tool in Windows 10 makes it fairly easy to clean up your computer. If any unwanted files remain, you can remove them manually. For example, clearing your temp folder. You can speed up this process with the help of commands to access the Disk Cleanup tool.

How to Use the Disk Cleanup Utility via Command Prompt

How to Clean Your Windows PC Using Command Prompt - The Talent500 Blog (1)

Disk Cleanup is a built-in Windows utility to help you free up space on your computer’s hard drive. It can clean up downloads, temporary internet files, recycle bins, and even system files.

You can use the Command Prompt to launch Disk Cleanup and perform automated cleanup tasks directly. Here is how to use the tool and supported command-line switches.

Basic File Deletion

You can use the cleanmgr command to launch the Disk Cleanup tool using Command Prompt. To use it:

Open Command Prompt with admin privileges by typing cmd in the search box, right-click on the command prompt and click on the run asadministrator. Type cleanmgr, and hit Enter.

How to Clean Your Windows PC Using Command Prompt - The Talent500 Blog (2)

How to Clean Your Windows PC Using Command Prompt - The Talent500 Blog (3)

In the Drive Selection window, select the drive you want to clean up and click OK.

How to Clean Your Windows PC Using Command Prompt - The Talent500 Blog (4)

Next, in the Disk Cleanup window, select all the files you want to delete and click OK. If you run cleanmgr with admin privileges, you will find more options to clean in the disk clean-up section.

How to Clean Your Windows PC Using Command Prompt - The Talent500 Blog (5)

Finally, click on Delete Files to confirm the action.

Cleanmgr /sageset

How to Clean Your Windows PC Using Command Prompt - The Talent500 Blog (6)

Executing this command skips the drive selection step and shows the Disk Cleanup settings window. From here, you can select the files to delete.

Delete Files Automatically

If you would rather let the Disk Cleanup utility decide what files to delete, use the command cleanmgr /sagerun. Upon execution, it will scan your drives and delete junk files from your system.

How to Clean Your Windows PC Using Command Prompt - The Talent500 Blog (7)


The low disk switch is useful if you are running low on storage space on your hard disk. When executed, it automatically checks all the file categories by default.

How to Clean Your Windows PC Using Command Prompt - The Talent500 Blog (8)

When executed, Disk Cleanup will open with all junk file categories selected from the D: drive.

To delete all junk files quickly, without the user prompt, use the following command instead: where d is the letter of the drive which is low on storage.

How to Clean Your Windows PC Using Command Prompt - The Talent500 Blog (9)

The Disk Cleanup tool cleans temporary files that are older than seven days. But if you have to clean the temp folder frequently, you can do it manually or use the Command Prompt.

You can delete the temp file manually (Ctrl + A > Delete) from File Explorer or use the following command to delete temp files:

How to Clean Your Windows PC Using Command Prompt - The Talent500 Blog (10)

Command Prompt will automatically skip any file that is currently in use, but it will delete the rest.

How to Delete Prefetch Files Using Command Prompt

Prefetch files are temporary files created when an application is run on your Windows system. These files contain information that is used to optimize the execution of programs.
Similar to other temporary files, prefetch files often don’t take up much space on your hard drive. However, if you need to delete prefetch files frequently, you can use the Command Prompt to clean up these files on your system.

To delete prefetch files using Command Prompt:

Open Command Prompt as administrator

How to Clean Your Windows PC Using Command Prompt - The Talent500 Blog (11)

To delete the prefetch files, use the following command and hit enter:

How to Clean Your Windows PC Using Command Prompt - The Talent500 Blog (12)

Keep Your Computer Clean From Junk Files Using Command Prompt

You can use the Command Prompt to perform various advanced actions, including removing junk files from your computer. While you can use the GUI-based Disk Cleanup tool, Command Prompt makes it easy to clean up individual category files and wipe clean disks.

You can also add these commands in a .bat file and run them all by just clicking the .bat file using admin privileges

How to create a .bat file and add the command

Open Notepad, by typing Notepad in the search box

How to Clean Your Windows PC Using Command Prompt - The Talent500 Blog (13)

This will open a blank text file

In this blank text file, enter all the commands one by one on separate lines

How to Clean Your Windows PC Using Command Prompt - The Talent500 Blog (14)

Click on file, save as to save the file. Type any name of your choice and then put the extension as .bat. here just as a demo, I have added only 2 commands. You can add many more. The commands will execute one by one.

How to Clean Your Windows PC Using Command Prompt - The Talent500 Blog (15)

This will create test.bat on your desktop. Now whenever you want to execute the commands, you can just double-click on the .bat file and the commands will run one by one. (make sure you right-click on the file and select run as administrator ) to get the best out of the disk cleanup commands)

1+

How to Clean Your Windows PC Using Command Prompt - The Talent500 Blog (2024)
Top Articles
What is Virtual Routing and Forwarding (VRF)? | Avi Networks
11 Reasons CFA Is Going to Be Big in 2024 | Zell Education
No Hard Feelings (2023) Tickets & Showtimes
Devon Lannigan Obituary
1970 Chevrolet Chevelle SS - Skyway Classics
Valley Fair Tickets Costco
Miss Carramello
Gameplay Clarkston
Vocabulario A Level 2 Pp 36 40 Answers Key
Wnem Radar
What to do if your rotary tiller won't start – Oleomac
Vanessa West Tripod Jeffrey Dahmer
Dtab Customs
1773X To
Huntersville Town Billboards
Days Until Oct 8
Tyrone Unblocked Games Bitlife
Between Friends Comic Strip Today
Myhr North Memorial
Qual o significado log out?
Cincinnati Adult Search
Craigslist Northfield Vt
Teekay Vop
Kentuky Fried Chicken Near Me
پنل کاربری سایت همسریابی هلو
Craigslist Dubuque Iowa Pets
Visit the UK as a Standard Visitor
Die wichtigsten E-Nummern
How often should you visit your Barber?
Trust/Family Bank Contingency Plan
A Plus Nails Stewartville Mn
Devotion Showtimes Near The Grand 16 - Pier Park
The Legacy 3: The Tree of Might – Walkthrough
Foolproof Module 6 Test Answers
Hisense Ht5021Kp Manual
Uc Santa Cruz Events
Me Tv Quizzes
Husker Football
Hireright Applicant Center Login
Lbl A-Z
Weekly Math Review Q2 7 Answer Key
Gotrax Scooter Error Code E2
Wordle Feb 27 Mashable
Tinfoil Unable To Start Software 2022
Avatar: The Way Of Water Showtimes Near Jasper 8 Theatres
Reilly Auto Parts Store Hours
R/Gnv
Das schönste Comeback des Jahres: Warum die Vengaboys nie wieder gehen dürfen
Walmart Listings Near Me
Acuity Eye Group - La Quinta Photos
Who Is Nina Yankovic? Daughter of Musician Weird Al Yankovic
Fahrpläne, Preise und Anbieter von Bookaway
Latest Posts
Article information

Author: Tuan Roob DDS

Last Updated:

Views: 5909

Rating: 4.1 / 5 (62 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Tuan Roob DDS

Birthday: 1999-11-20

Address: Suite 592 642 Pfannerstill Island, South Keila, LA 74970-3076

Phone: +9617721773649

Job: Marketing Producer

Hobby: Skydiving, Flag Football, Knitting, Running, Lego building, Hunting, Juggling

Introduction: My name is Tuan Roob DDS, I am a friendly, good, energetic, faithful, fantastic, gentle, enchanting person who loves writing and wants to share my knowledge and understanding with you.