Windows/Delete Unowned Folder: Difference between revisions

From Omnia
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
Run from a user in Administrators group, and from a command line window elevated to Administrator permission
Run from a user in Administrators group, and from a command line window elevated to Administrator permission


# Take ownership as self
  takeown /f "C:\Path\To\Folder" /r /d y
  takeown /f "C:\Path\To\Folder" /r /d y
  # OR
# Take owenership as Administrator group
takeown /A /f "C:\Path\To\Folder" /r /d y


# Give full permission to Administrator group
  icacls "C:\Path\To\Folder" /grant Administrators:F /t
  icacls "C:\Path\To\Folder" /grant Administrators:F /t


# remove the directory
  rmdir /s /q "C:\Path\To\Folder"
  rmdir /s /q "C:\Path\To\Folder"

Revision as of 08:11, 5 January 2026

Run from a user in Administrators group, and from a command line window elevated to Administrator permission

# Take ownership as self
takeown /f "C:\Path\To\Folder" /r /d y
 # OR
# Take owenership as Administrator group
takeown /A /f "C:\Path\To\Folder" /r /d y
# Give full permission to Administrator group
icacls "C:\Path\To\Folder" /grant Administrators:F /t
# remove the directory
rmdir /s /q "C:\Path\To\Folder"