Delete Windows System Folder

Delete windows system files from command prompt screenshot with windows shield icon and windows logo.

When you are dealing with a secondary drive or trying to use an old system drive as a storage device, you might want to get rid of the files and directories created by Windows. But Windows’s system files are owned by SYSTEM or TrustedInstaller by default and they do not provide full directory access control to any of the normal users, including the administrators.

To do that, you’d usually navigate to the files in the explorer window and use the properties window of the system directories to take control of the directories so that you can remove them the usual way. But if you are reading this, you might have hit a snag or find the whole process a hassle. In those cases, use the following three commands from an elevated command prompt to finish the job quicker.

takeown /F "H:\Windows" /A /R /D Y

icacls "H:\Windows" /T /grant administrators:F

rd /s /q "H:\Windows"

Replace the H: with the drive letter of the drive you are trying to delete system folders from. The first two commands recursively change the ownership of the system directories (like the Program Files and Windows folders) and subdirectories to the administrator user, and grants the full access control. The third command finally removes the directory.

First published Mar 5, 2014.

We totally get why you have an ad blocker. If you enjoy reading Geekswipe, turning it off for us helps keep the site alive and the science coming.

31 articles

We're a clique of geeks, nerds, professionals who co-exist peacefully at Geekswipe, writing on science, technology, culture, and answering your curious questions.

More by Geekswipe Team

Leave a comment

Only used to notify you of replies. Never published.

Related