How to clean WinSXS folder & Save 5GB disk space in 1 minute - Windows Basics

Latest

Thursday, November 14, 2024

How to clean WinSXS folder & Save 5GB disk space in 1 minute

Windows uses a system folder called WinSxS to store Windows installation files as well as backup files or update files. However, these files take up a lot of space on the system drive. Therefore, you should delete these folders and files to free up space on your Windows computer.

What exactly is the WinSxS folder?

Before learning how to delete the WinSxS folder, let's go over some important points.

First of all, you cannot completely delete the WinSxS folder, but you can definitely reduce its size. The reason is that the WinSxS folder contains many important libraries and components of the operating system. They are necessary in solving problems related to the operating system. So, in a way, users should not touch the WinSxS folder because it is there to keep the PC safe and stable.

The problem, however, is that the WinSxS folder keeps growing over time, and if you’ve been using your computer for years, it can take up about 40% of your operating system’s hard drive, which is pretty concerning.

So what exactly is going on in that folder? In fact, in addition to the operating system components, Windows also keeps update files in the WinSxS folder. So whenever you get a new update, the files are downloaded and stored, just in case you run into problems in the future and want to roll back to a previous build. Basically, every time you get an update, the files accumulate in that folder, leading to a staggering increase in the operating system’s hard drive space.

It would be wrong to say that Microsoft isn’t trying to fix the problem. Currently, Windows 10 comes with an automatic maintenance service that cleans up files that have been replaced after a month. However, users report that it does not work as intended.

Anyway, now that you understand the problem, you can take steps to reduce the size of the folder so that it does not hinder the stability of the system.

1.Use Disk Cleanup to delete old updates from the SxS folder

1. First, open the Disk Cleanup tool by typing disk cleanup in the Search box on the Start Menu or on the Taskbar and pressing Enter. In the search results list, click Disk Cleanup.

2. In the Disk Cleanup tool window, click the Cleanup system files button.

3. Check Windows Update Cleanup.

4. Finally, click OK and you are done.

2. Use Command Prompt to Delete the SxS Folder

If you want to see how much free space the SxS folder is taking up, you can use Command Prompt.

1. Open Command Prompt as Admin. To do this, type cmd in the Search box on the Start Menu or the Search box on the Taskbar. In the search results list, right-click Command Prompt and select Run as administrator.

Or, right-click the Start button in the bottom left corner of the screen and select Command Prompt (Admin).

2. In the Command Prompt window, type the following command and press Enter:

Dism.exe /online /Cleanup-Image /StartComponentCleanup

Wait a few minutes for the DISM tool to analyze the folder. Once completed, you will see how much space the SxS folder is taking up.

3. To delete the SxS folder, enter the following command in the Command Prompt window:

Dism.exe /online /Cleanup-Image /StartComponentCleanup

You can also use another command to uninstall Windows Updates and service packs to free up space. Use the following command:

Dism.exe /online /Cleanup-Image /StartComponentCleanup

The execution process of the command depends on the system and the size of the file you delete. 

3. Delete the WinSxS folder using the StartComponentCleanup task

The StartComponentCleanup task was created in Windows 8 to automatically clean up components on a regular basis, when the system is not in use. This task is set to run automatically when triggered by the operating system. When running automatically, the task will wait at least 30 days after an updated component is installed, before uninstalling previous versions of that component.

If you choose to run this task, the task will have a 1 hour wait time and may not completely clean up all files.

The StartComponentCleanup task can also be started from the Command Prompt with admin privileges:

schtasks.exe /Run /TN "\Microsoft\Windows\Servicing\StartComponentCleanup"

1. Press the Win+R keys to open Run, type taskchd.msc into Run, and press OK to open the Task Scheduler.

2. Navigate to and open the following folder in the left pane of Task Scheduler:

Task Scheduler Library\Microsoft\Windows\Servicing

3. In Servicing in the middle, select the StartComponentCleanup task and click Run in the Selected Item on the right.

4. The StartComponentCleanup task will run until it completes (this may take some time).

4. Remove the WinSxS folder using /StartComponentCleanup and /ResetBase with the Dism command

Using the /ResetBase switch with the /StartComponentCleanup parameter of DISM.exe on your running Windows 10 instance will remove all superseded versions of every component in the component store.

All current service packs and updates cannot be uninstalled after this command is completed. This will not block future service packs or updates from being uninstalled.

1. Open a Command Prompt with admin privileges.

2. Type the following command into the Command Prompt and press Enter.

Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase

3. When finished, you can close the Command Prompt if you like. This execution may take a while to complete.

5. Delete the WinSxS Folder Using /SPSupersed with the Dism Command

To reduce the amount of space used by a service pack, use the /SPSuperseded parameter of Dism.exe on your running version of Windows 10 to remove any backup components needed to uninstall the service pack. A service pack is a collection of cumulative updates for a specific release of Windows.

This option will most likely never be needed for Windows 10, as service packs are no longer used for Windows 10.

The service pack cannot be uninstalled after this command completes.

1. Open a Command Prompt with admin rights.

2. Type the command below into the Command Prompt and press Enter.

Dism.exe /online /Cleanup-Image /SPSuperseded

3. When finished, you can close the Command Prompt if you want. This execution may take a while to complete.

Good luck!

No comments:

Post a Comment