How to Delete Windows.old Folder (Including Force Delete With CMD)

Martin Brinkmann
Updated •
Windows

To delete Windows.old, open Settings > System > Storage > Temporary files, tick "Previous version of Windows" and select Remove files. If that option is missing or the folder refuses to go, open an elevated Command Prompt and run three commands: takeown to take ownership, icacls to grant Administrators full access, and rmdir /S /Q to remove the folder.

Deleting Windows.old is permanent and ends your ability to roll back to the previous Windows version. This guide covers the Settings method first, then the command line fix for "Access denied" errors.

Delete Windows.old with Settings (recommended)

The safest way to delete Windows.old is the built-in Storage page, because Windows removes the folder itself and handles the permissions for you. Microsoft documents the steps, and they require administrator rights.

  1. Open Settings and go to System > Storage.
  2. Select Temporary files under your drive information and wait for the scan to finish.
  3. Tick the "Previous version of Windows" check box.
  4. Select Remove files and confirm.

Microsoft states that the previous version of Windows is deleted automatically ten days after an upgrade, so manual removal is only needed if you want the space sooner. The older Disk Cleanup route also still works, as our Disk Cleanup guide for Windows.old explains. To see how much space the folder actually uses before you decide, a tool such as WizTree shows folder sizes quickly.

Why Windows.old gives "Access denied"

Windows.old refuses normal deletion because its files are associated with the SYSTEM account, not your administrator account. In File Explorer you typically see a prompt for administrator permission, followed by a "Folder Access Denied" message.

Folder Access Denied error when deleting the Windows.old folder in File Explorer

Adding yourself to the folder's security tab by hand is possible, but it is slow on a folder with thousands of files. The command line does the same job in three steps: take ownership, grant permissions, delete.

Force delete Windows.old from the command line

To force delete Windows.old, run takeown, icacls and rmdir from an elevated Command Prompt, in that order. Open the Start menu, type cmd, and press Ctrl+Shift+Enter to launch it as administrator (or choose Run as administrator).

  1. takeown /F C:\Windows.old /R /A /D Y
  2. icacls C:\Windows.old /grant *S-1-5-32-544:F /T /C /Q
  3. rmdir /S /Q C:\Windows.old

Check the drive letter first: if Windows is installed on another drive, replace C: accordingly. The rmdir command cannot be undone and skips the confirmation prompt, so make sure you no longer need to roll back.

What each command does

Each command handles one permission problem, and knowing the switches lets you adapt them safely. The switches below are taken from Microsoft's takeown reference, icacls reference and rmdir reference.

Command Switch Meaning
takeown /F, /R Target the folder and process all files and subfolders
takeown /A, /D Y Give ownership to the Administrators group; answer Y to the prompt for folders you cannot list
icacls /grant *S-1-5-32-544:F Grant full access (F) to the Administrators group, written by its SID so it works on any Windows language
icacls /T /C /Q Apply to all subfolders, continue on errors, suppress success messages
rmdir /S /Q Delete the whole directory tree without prompting

The older version of this guide used cacls, which Microsoft lists as deprecated in favor of icacls, so the steps above use icacls instead.

FAQ

Why is "Previous version of Windows" missing from Temporary files?

The entry only appears while Windows.old exists and can be removed. If it is missing, the folder may already have been deleted automatically (Microsoft says this happens ten days after an upgrade), or the PC was never upgraded in place.

The commands still fail with Access denied. What now?

Confirm the Command Prompt title says Administrator, close any File Explorer window that has the folder open, and restart the PC before trying again. If a single file still fails, the icacls /C switch lets the rest continue so you can retry rmdir afterwards.

Can I get Windows.old back after deleting it?

No. Microsoft notes the deletion cannot be undone, and the folder holds the files needed to return to your earlier Windows version. Copy any personal files you still want out of it before you delete.

Related: Upgrade to Windows 11 with the Installation Assistant, Diagnose Windows upgrade issues with SetupDiag, Manage System Restore from the command line

Comments

  1. Anonymous said on
    Reply

    Nothing else worked, including manually taking ownership, system tools, etc., but this did the trick. Thank you for your service.

  2. Jibun no Kage said on
    Reply

    Does not work, take ownership runs but is incomplete, but cacls fails with multiple access denied even after ownership take. Yes, ran CLI in CMD as administrator, and using administrator account. Thus rmdir fails badly since ownership and cacls both fail. So as of the date of this comment, your solutions fails.

  3. Adrian Lincoln said on
    Reply

    Brilliant – just what I was needed. For some inexplicable reason the usual windows10 cleanup utility of temporary files didn’t have an option to remove the previous install. (why not ???). Many thanks.

  4. Anonymous said on
    Reply

    Hmmm. Copied the text into a batch file and ran it… and promptly toasted the computer. If copied directly from the web page, there are spaces in the command which affect how it runs. Before I could do anything, many directories were obliterated. Fortunately, it was a test machine and I could afford to lose that stuff, but still have to rebuild that system from scratch.

  5. Anonymous said on
    Reply

    i get a bunch of errors in feedback on the first cmd, and access denied when i run the second or third…

  6. Anonymous said on
    Reply

    Old thread but wanted to say thanks, the folder was renamed during the win10 upgrade and the system wouldn’t do it automatically. Great advice, worked perfectly and freed up 15G!

  7. Suzanne said on
    Reply

    THANK YOU! I don’t know why everyone thinks that disk cleanup will ALWAYS work. I never had an option to remove the previous version of windows. You made my day!

  8. JOey said on
    Reply

    THANK YOU SOO MUCH SAVED ME 20GB been looking for this , the app unlocker takes ages to delete 100mb

  9. Charlie said on
    Reply

    Excellent!
    had to run it twice, but it did the trick

  10. Charles said on
    Reply

    Disk cleanup doesn’t see the Windows.old folder in many cases. This article was a lifesaver, thank you!

  11. PattyPP said on
    Reply

    Good God.

    Why would you want to memorize all those long and dangerous commands?

    Just use Windows “disk cleanup” and click the checkbox.

    Ugh.

  12. Woody Glendell said on
    Reply

    This WORKED!!!! THANK YOU! THANK YOU! THANK YOU!

  13. Costa said on
    Reply

    The execution of the 2 cmd

    “cacls C:\Windows.old\*.* /T /grant administrators:F”

    stops after a while with the error:

    “the data area path to a system call is too small”

    What do i do?

    1. Anonymous said on
      Reply

      Costa are you doing this from a command prompt or from powershell? I had a similar error in Powershell but it worked just fine in command prompt.

  14. R. Haukom said on
    Reply

    Dear Ghacks.net Administrator: Please note that in the command sequence noted above (takeown /F c:\Windows.old\* /R /A /D Y) to manually remove Windows.old directory and its contents has a typographical error… the command shown om example 2. is “takeown /F c:\Windows.old\* /R /A /D Y”. Tried this and it was not successful in changing the ownership conditions of any files in the target directory. On examination of the explanation text below the suggested commands, I noted that the trailing command switches to the command should have a dash (-) preceding the command switches instead of the slash (/) as shown in the example. I retried the takeown command with the following changes…”takeown /F c:\Windows.old\* -R -A -D Y” which was successful in changing the ownership conditions on all files in the Windows.old directories. The following commands shown in example 3. and 4. were successful as well.
    I know you strive for excellence in your advice to your readers. Please try to update the information I have noted above. Sincerely, RDH, an appreciative reader

    1. SillyOldDude said on
      Reply

      Thank you RDH. “takeown /F c:\Windows.old\* -R -A -D Y” worked for me. Thanks.

  15. Sebastian42 said on
    Reply

    Although no files show in Explorer, the excuse given for not deleting is ‘folder not empty’ – that was BEFORE your code and still after your code.

  16. Jim Potyoposin said on
    Reply

    access denied
    you are irrelevant don’t write things and confuse us

  17. Anonymous said on
    Reply

    Great worked great for me

  18. Arcionquad said on
    Reply

    It worked!

    Thanks.

  19. Michael Wallace said on
    Reply

    _____THANK_____YOU !!!!!!!!!!!!!!!!!!!!!

    I wrestled with this for about an hour. Cortana would not give up the ghost.

    I rebooted into safe mode, and applied your fix, and WINDOWS.OLD is now GONE !!!!!

  20. Steve W said on
    Reply

    Thank you! This worked perfectly where windows.old would not remove through all other methods.

  21. Fame said on
    Reply

    Thank you
    Worked like a charm. Keep up the good work

  22. Lo Ha said on
    Reply

    “Zuordnungen von Kontennamen und Sicherheitskennungen wurden nicht durchgeführt”
    Meaning: “Assignments of accounts and security-states are Not altered.”

  23. Lo Ha said on
    Reply

    “Zuordnungen von Kontennamen und Sicherheitskennungen wurden nicht durchgeführt ”
    Meaning:”Assignments of accounts and security-states are Not altered.”

  24. chesscanoe said on
    Reply

    I used Google to search the German phrase and translate the result to English. Perhaps https://community.norton.com/de/forums/zuordnungen-von-kontennamen-und-sicherheitskennungen-wurden-nicht-durchgef%C3%BChrt-vista-32-gho-0 will help from Norton.

  25. Lo Hanisch said on
    Reply

    LoHa

    command 2 answered:”Zuordnungen von Kontennamen und Sicherheitskennungen wurden nicht durchgeführt.”
    What to do?

    aloha

  26. TianlanSha said on
    Reply

    I’ve seen another method where you run Disc Cleanup and it deletes it.

    1. Martin Brinkmann said on
      Reply

      Yes, Disk Cleanup deletes it usually, but there are situations where this won’t work, or where leftovers remain.

      1. Rasthro said on
        Reply

        When i typed: rmdir /S /Q c:\Windows.old
        Only access is denied error shows up even if the takedown command worked how come nothing works for me while it works for everybody else,

      2. Mark Hazard said on
        Reply

        Yes, disk cleanup deleted the files but not the folder. When I tried to delete the folder manually, I got the response that the file was corrupted and unreadable. I searched the Web for an answer, which was to use Chkdsk. When I did that, I was told that the file was in use by another program(?). I was asked if I wanted to run Chkdsk on the the next restart. I answered yes, and restarted. Chkdsk worked seemingly very quickly, and when I tried to delete Windows.Old, I got the same response. I repeated the process, and this time Chkdsk worked more slowly. Then I was finally able to delete Windows.Old.

        The Chkdsk command that I used from an administration account was chkdsk C: /F. I tried another version using /B but it did not work. This was on Windows 8.1.

  27. Arie said on
    Reply

    Boot from a Linux live cd / dvd, go te the folder where windows.old is located, delete it, done

  28. jasray said on
    Reply

    Bastante para ahora–

    takeown /F C:\Windows.old\* /R /A
    pause
    cacls C:\Windows.old\*.* /T /grant administrators:F
    pause
    rmdir /S /Q C:\Windows.old\
    pause

    Copy-paste this in Notepad and save it as a .bat file.

    1. mamatkroghr said on
      Reply

      thank bro..

    2. Yoyoyo said on
      Reply

      Thank you, it worked perfectly! It saved me 15GB on my tiny SSD Woop woop! I hope you have a good day sir :D

    3. Rentadanny said on
      Reply

      Thank you Sir.

    4. Bearman_18 said on
      Reply

      This guy is a friggin’ hero.

    5. Josh said on
      Reply

      Awesome, love it!

    6. Ephos said on
      Reply

      worked well for me thanks @ jasray

  29. dmacleo said on
    Reply

    if on domain may work bit different, can rt click folder properties-security-advanced-change permissions.
    then where it lists owner click change and use domain admin acct.
    click the replace all child object box.
    then apply, ec then delete.
    have had to do it to 15 or so of them lately..

Leave a Reply

By commenting, you accept our privacy policy and keep the discussion respectful and on topic.