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 ruta

    File or folder to take; wildcards are accepted.

  • /a

    Gives ownership to the Administrators group instead of the current user.

  • /r

    Acts recursively on the folder's content.

  • /d respuesta

    Default answer if it has to ask about permission to list a folder; Y or N, or S in Spanish Windows.

  • /s equipo

    Remote computer to act on.

Usage examples

  • takeown /f archivo.txt

    Makes you the owner of the file.

  • takeown /f C:\Datos /r /d S

    Takes ownership of the folder and all its content.

  • takeown /f C:\Datos /a /r /d S

    Gives ownership to the Administrators group.

  • icacls archivo.txt /grant %USERNAME%:F

    After 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.

Related commands