Deleting Hard-to-Delete Windows Files

The Windows system is very protective, and tries to prevent users from doing things that it regards as potentially crazy. Unfortunately, the developers at Microsoft have in the process made some reasonable tasks unnecessarily difficult and time-consuming to perform.

If you take a hard drive from a failed system and install it as a secondary hard drive in a working system, you may wish to delete the Windows software from the transferred hard drive and just leave the original user accounts. This would free a lot of space for other uses.

If you try deleting the old Windows software in the usual way, you will run across a number of problems. One of these is that you will not have ownership of any of the files and folders on the transferred hard drive. Once you have taken ownership of the files and folders, you may find that you do not have permission to do what you want with them.

Here are some commands for getting rid of hard-to-delete files:

  1. Take ownership of the files…
    takeown /F e:\Windows\* /R /A /D Y
  2. Make changes to the Access Control Lists…
    cacls e:\Windows\*.* /T /grant administrators:F
  3. Remove the unwanted directory…
    rmdir /S /Q e:\Windows

If you would rather not mess around with command-line utilities such as ‘takeown’ and ‘cacls’ there are quicker, easier ways to take ownership of files and folders and make sure that you have the required permissions to do whatever you want with them.