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

Hither are a few ways to clean upwards a slow Windows reckoner using Control Prompt.

Why Clean Up Your Computer Using Command Prompt?

Command Prompt is a built-in control processor available on well-nigh all Windows versions since Windows 3.one. While the graphical user interface is handy for most people, some may prefer the Command Prompt to perform several tasks for its efficiency and functioning benefits.

If you are new to Microsoft's popular command processor, cheque out our beginner'due south guide to the Windows Control Prompt.

The Deejay Cleanup tool and the Storage Sense feature in Windows 10 make it fairly easy to clean upwards your computer. If whatsoever unwanted files remain, you can remove them manually by, for example, immigration your temp folder. Y'all can speed up this process with the help of commands to access the Deejay Defragmenter, diskpart, and the Disk Cleanup tool.

Commands to Clean Your Figurer Using CMD

Beneath is the list of commands to launch the disk cleanup utility, clean temporary files, memory enshroud, and more.

Some of these commands may crave you to open Command Prompt every bit administrator. Here's how to practice it.

  1. Type cmd in the Windows search bar.
  2. Right-click on Command Prompt.
  3. Select Run every bit administrator.

How to Defragment Hard Disk With Command Prompt?

While disk fragmentation on traditional difficult disks is a natural occurrence, it can crusade functioning issues. It affects the access and write speed of your disk, making your organisation irksome.

The Windows Command Prompt in the process of defragmentation, showing volume information and the expected results

Defragmentation rearranges fragmented information to aid your disks piece of work more efficiently. You don't need to defragment your SSD drives, but if you use a mechanical drive, here's how to defragment the hard disk with a control.

  1. Open the Command Prompt equally ambassador.
  2. In the Command Prompt, blazon the following command and hit enter:
                  defrag c:            
  3. In the in a higher place command, c: is the drive that you lot want to defrag. Change the drive letter if you want to defrag another drive.

You tin can run the defrag command with optional switches. This Microsoft Documentation offers more insight into using dissimilar syntax with the defrag command to perform analysis, add exceptions, change priority, and more.

How to Utilise the Disk Cleanup Utility via Command Prompt

The Windows Disk Cleanup program, a GUI app launched from a command prompt

Disk Cleanup is a built-in Windows utility to help yous complimentary up space on your computer's difficult drive. It can clean up downloads, temporary internet files, recycle bin, and even organisation files.

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

Basic File Deletion

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

  1. Open Control Prompt, blazon cleanmgr, and hitting Enter.
  2. In the Drive Pick window, select the bulldoze yous desire to clean up and click OK.
  3. Next, in the Deejay Cleanup window, select all the files yous want to delete and click OK.
  4. Finally, click on Delete Files to confirm the action.

Skipping Bulldoze Selection

          cleanmgr /sageset        

Executing this command skips the drive selection footstep and shows the Disk Cleanup settings window. From hither, y'all can select the files to delete.

Delete Files Automatically

If yous would rather let the Disk Cleanup utility determine what files to delete, apply the cleanmgr /sagerun variant. Upon execution, information technology will scan your drives and delete junk files from your system.

          cleanmgr /sagerun        

Optimize for Low Space

The lowdisk switch, as the name suggests, is useful if y'all are running depression on storage space on your hard disk. When executed, it automatically checks all the files categories by default.

When using this form of the command, enter the drive letter of the alphabet for the partition to free up space. The command will expect something like this:

          cleanmgr /lowdisk /d        

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

To delete all junk files quickly, without the user prompt, utilize the following command instead:

          cleanmgr /verylowdisk /d        

How to Clear Temporary Files Using Command Prompt?

Windows creates temporary files for momentary use. Temp files rarely occupy a large space on your hard bulldoze and are essential for the smooth performance of your system. When the task is consummate, your system should automatically discard them from the temporary folders.

The Deejay Cleanup tool cleans temporary files that are older than seven days. Merely if you take to make clean the temp folder oft, you tin can exercise information technology manually or using the Command Prompt.

The Windows Command Prompt with the del command in progress, showing some individual files that cannot be deleted

To view temporary files, enter the following command in Command Prompt:

          %SystemRoot%\explorer.exe %temp%\        

You tin delete these files manually (Ctrl + A > Delete) from the File Explorer or use the post-obit command to delete temp files:

          del %temp%\*.* /s /q        

Control Prompt will automatically skip any file that is currently in utilise, but it volition delete the rest.

Cleaning a Hard Disk Using Diskpart

If y'all want to wipe make clean an entire disk, yous tin can use the diskpart utility. Diskpart is a Windows command-line utility with back up for over 38 commands for unlike functions.

To wipe clean a disk, you tin use diskpart's clean control. Upon execution, it deletes all the data and converts the disk into unallocated space.

The Windows command prompt running the DiskPart program, with available volumes listed

Practise caution when using the diskpart utility. Using incorrect objects can price yous all of your data, and y'all may not be able to recover any of it at all. Therefore, nosotros recommended you lot create a backup of your important system information before using the diskpart tool.

To make clean a disk:

Go on Your Computer Clean From Junk Files Using Command Prompt

Yous tin can use the Command Prompt to perform various advanced actions, including removing junk files from your reckoner. 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.

  1. Type diskpart In the Command Prompt and hit enter.
  2. Next, type list disk to view all the installed disks on your system
  3. Select the disk you want to wipe make clean. For example:
                  Select disk 0            
  4. If the disk status shows offline, type online disk and striking enter.
  5. To wipe clean your disk, type the following control and striking enter:
                  Make clean all            
  6. Once completed, type leave to close diskpart.

15 Windows Control Prompt (CMD) Commands Yous Must Know

Read Next