[Fix] Can’t Remove the $WINDOWS.~BT Folder

The Windows Setup procedure or the Media Creation Tool may fail to clear the temporary setup files in some cases. As a result, gigabytes of disk space will be occupied by those folders. When you manually delete the temporary setup folder $WINDOWS.~BT, you may receive an Access Denied error.

File Access Denied

You need permission to perform this action.

You need permission from TrustedInstaller to make changes to this file.

clear temporary setup folder $WINDOWS.~BT access denied

Let’s see how to clear the temporary setup folders, namely, $WINDOWS.~BT, $WINDOWS.~WS, and ESD.

Resolution

Method 1: Using Disk Cleanup

  1. Launch the Disk Cleanup (cleanmgr.exe) tool.
  2. Select the C: drive and click OK.
  3. Click Clean up system files. Disk Cleanup will now relaunch as administrator.
  4. Select the C: drive and click OK.
  5. Enable the Temporary Windows installation files checkbox, and click OK.
    clear temporary setup folder $WINDOWS.~BT
  6. Click the Delete Files button when you see the “Are you sure you want to permanently delete these files?” prompt.That’s it. The Disk Cleanup tool will now delete the following folders:
    C:\ESD\Download
    
    C:\$WINDOWS.~BT
    
    C:\$WINDOWS.~WS

    clear temporary setup folder $WINDOWS.~BT


Method 2: Using Command Prompt

If the Disk Cleanup tool doesn’t show the Temporary Windows installation files checkbox or doesn’t clear the temporary setup folders, you can use the admin Command Prompt to delete those folders.

Open Command Prompt (admin) and run these commands:

del /s /f /q "C:\$WINDOWS.~BT"
del /s /f /q "C:\$WINDOWS.~WS"
del /s /f /q "C:\ESD\Download"

takeown /F "C:\$WINDOWS.~BT" /A /R /D Y
icacls "C:\$WINDOWS.~BT" /grant *S-1-5-32-544:F /T /C /Q
rd /s /q "C:\$WINDOWS.~BT"

takeown /F "C:\$WINDOWS.~WS" /A /R /D Y
icacls "C:\$WINDOWS.~WS" /grant *S-1-5-32-544:F /T /C /Q
rd /s /q "C:\$WINDOWS.~WS"
rd /s /q "C:\ESD\Download"

Method 3: Using the TrustedInstaller Command Prompt

Download the Advanced Run utility from Nirsoft and run it.



Using Advanced Run, launch CMD.exe as TrustedInstaller. Reference: How to Run Programs as TrustedInstaller

advancedrun - trustedinstaller

In the TrustedInstaller Command Prompt, run the following commands:

rd /s /q "C:\$WINDOWS.~BT"

rd /s /q "C:\$WINDOWS.~WS"

rd /s /q "C:\ESD\Download"

That’s it!


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support. It won't take more than 10 seconds of your time.

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a ten-time recipient of the Microsoft MVP award in Windows Desktop Experience (Windows Shell), from 2003 to 2012. Ramesh founded Winhelponline.com in 2005.

Leave a Comment