takeown
Windows CMD · Files · reference only
What it does
Takes ownership of a file or folder, so you can then change its permissions when the current owner does not let you in.
Syntax
takeown /f ruta [opciones]
Options and parameters
/f rutaFile or folder to take; wildcards are accepted.
/aGives ownership to the Administrators group instead of the current user.
/rActs recursively on the folder's content.
/d respuestaDefault answer if it has to ask about permission to list a folder; Y or N, or S in Spanish Windows.
/s equipoRemote computer to act on.
Usage examples
takeown /f archivo.txtMakes you the owner of the file.
takeown /f C:\Datos /r /d STakes ownership of the folder and all its content.
takeown /f C:\Datos /a /r /d SGives ownership to the Administrators group.
icacls archivo.txt /grant %USERNAME%:FAfter takeown, grants full control to the current user.
Notes and common mistakes
- It must run in a console with administrator rights.
- Changing ownership of system files can cause problems: use it only on your own data.