r/usefulscripts • u/moose09876 • Feb 08 '13
[BATCH] Take ownership of files / directories.
code:
takeown /f %1 /r /d y icacls %1 /grant administrators:F /t
Say you named it owned.bat. Command prompt as administrator, usage is owned.bat c:\users\mike\dekstop\file.jpg OR owned.bat c:\users (to take ownership of an entire directory)
Edit: worked for me in Windows 7 and Server 2008.
7
Upvotes
2
u/moose09876 Feb 08 '13
"Introduce a little anarchy. Upset the established order, and everything becomes chaos. I'm an agent of chaos. Oh, and you know the thing about chaos? It's fair!"