When upgrading a computer to a newer version, Windows creates the Windows.old folder containing the older version, as a protective measure in case something goes wrong and a system restore is required.
As mentioned above, the Windows.old folder contains all the files and folders of the old Windows installation. The folder is not stored for a very long time, and is automatically deleted by Windows.
Of course, you can use the Disk Cleanup tool to delete the folder, especially if you're running low on space. If you now try to delete the folder manually from your File Explorer, you'll notice errors appearing stating that you don't have permission because the folder contains system files.
Remove the Windows.old folder manually
To do this you will need to run the following commands in the cmd.exe context:
Open a cmd window with administrator privileges. To do this easily, press the button with the Windows, and type cmd. Hold down the Shift + Ctrl keys together and press Enter.
If you have difficulty with the above, open the Windows menu and search for cmd.exe. Right-click on the black icon and “Open as Administrator”
The three commandments
takeown /F c:\Windows.old\* /R /A /DY
cacls c:\Windows.old\*.* /T /grant administrators:F
rmdir /S /Q c:\Windows.old
Let's look at the commands carefully to understand what they do:
takeown /F c:\Windows.old\* /R /A /DY
Takeown can be used to make the administrators group the owner of a file or folder.
/F c:\Windows.old\* – This specifies the location and files on which the operation will be performed.
/R – performs a recursive operation on all files located in the Windows.old folder
/A – gives ownership to the Administrators group.
/DY – answers the confirmation question when the current user does not have the “List Folder” permission.
cacls c:\Windows.old\*.* /T /grant administrators:F
This command displays or modifies DACL (discretionary access control list) files.
c:\Windows.old\*.* – The files you want to perform the operation on.
/t – Changes the DACL of the files in the selected folder and all subfolders.
/grant administrators:f – Grants full access rights to the administrators group (F stands for Full)
rmdir /S /Q c:\Windows.old
The command deletes the folder
/S – This parameter allows deleting the specified folder, all its subfolders and files.
/Q – runs the program in quiet mode without confirmation prompts.
c:\Windows.old – specifies the folder to be deleted.
