How to Delete the Windows.old Folder

🛠️Part of the Windows Administration Complete Guide, every Windows administration post on this site, grouped by the job you are doing.

To delete the C:\Windows.old folder, use Disk Cleanup or Settings > System > Storage > Temporary files and remove Previous Windows installation(s). Do not try to delete the folder by hand: it is owned by the system, so File Explorer refuses with permission errors and leaves half of it behind.

Windows creates Windows.old when you upgrade to a new version, and it can easily be 15 to 30 GB. It is your way back: it holds the previous version so you can roll back, and Windows deletes it by itself once the rollback period ends, which is 10 days by default. You only need to remove it yourself when you want the space back sooner.

Before you delete it: once it is gone, there is no going back to the previous version of Windows. Make sure the upgrade is working, especially on a work machine.

Properties of the C:\Windows.old folder showing the space it uses

Check How Much Space It Uses

Right-click the folder and choose Properties, as above, or get the size from PowerShell:

PowerShell
# Size of C:\Windows.old in GB
$bytes = (Get-ChildItem C:\Windows.old -Recurse -Force -ErrorAction SilentlyContinue |
    Measure-Object -Property Length -Sum).Sum
[math]::Round($bytes / 1GB, 1)

More ways to size folders are in Get Folder Size in PowerShell, and if the C: drive is filling up for other reasons too, Find What Is Filling Your C: Drive With PowerShell.

Delete Windows.old With Disk Cleanup

Disk Cleanup works the same on Windows 10, Windows 11 and Windows Server with the Desktop Experience.

Open Disk Cleanup. Type Disk Cleanup in the Start menu and open it, then pick the C: drive if it asks.

Searching for Disk Cleanup in the Start menu

Switch to system files. Click Clean up system files. The previous installation is a system file, so it is not in the first list. The scan takes a minute.

Disk Cleanup for the C: drive with the Clean up system files button
Disk Cleanup scanning system files

Tick Previous Windows installation(s). It is in the list with its size beside it.

Disk Cleanup system files list with Previous Windows installation(s) ticked

Confirm. Click OK, then Delete Files.

Disk Cleanup asking to confirm deleting the selected files

Windows warns you once more that you will not be able to go back to the previous version:

Disk Cleanup warning that the previous version of Windows can no longer be restored

Wait for it to finish. On a big folder this can take several minutes.

Disk Cleanup removing the previous Windows installation

When it is done, Windows.old is gone from the C: drive:

The C: drive with the Windows.old folder removed

Delete It From Settings on Windows 11

Windows 11 has the same option in Settings: Settings > System > Storage > Temporary files, tick Previous Windows installation(s), then Remove files. It only appears in the list when there is a previous installation to remove.

Keep Windows.old Longer Instead

Sometimes the opposite is what you want: more than 10 days to be sure an upgrade is good before the way back disappears. From an elevated Command Prompt, DISM shows and changes the rollback window, from 2 to 60 days:

Command Prompt
rem Show how many days you have left to roll back
DISM /Online /Get-OSUninstallWindow

rem Set the window in days: any number from 2 to 60 (30 here)
DISM /Online /Set-OSUninstallWindow /Value:30

On my machine there is nothing to roll back to, so DISM answers with Error: 1168, Element not found. That is what you see when there was no recent upgrade, or the rollback window has already run out:

DISM /Online /Get-OSUninstallWindow returning Error 1168 Element not found on a machine with no rollback window

Run it soon after the upgrade: once the rollback files are gone, there is nothing left to extend.


Related

If SQL Server is part of your day job, my current work lives over at sqldba.blog: production DBA scripts, an error library and the SSMS guide.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *