Windows locked directories

I ran across a server today that just wouldn’t allow me to delete a Quickbooks Update folder.  I used the Windows shell to grant access, take ownership, etc, but no matter what I did, it just would NOT allow me to delete the QBUpdate folder.  (@#$@#%@)

Found this on a Google search, tried it, and it worked perfectly.  Posting here for future reference…….

SET DIRECTORY_NAME="C:\Locked Directory"
TAKEOWN /f %DIRECTORY_NAME% /r /d y
ICACLS %DIRECTORY_NAME% /grant administrators:F /t
PAUSE
Posted in Uncategorized.