Skip to content

Windows TAKEOWN command

The Windows takeown command is a powerful tool that allows users to take ownership of files and folders on their system. This command is especially useful when dealing with system files or when encountering permission issues. By using the takeown command, users can assert control over files and folders, enabling them to make necessary modifications or deletions. This command is executed through the Windows Command Prompt, providing a straightforward way to manage permissions and ownership within the operating system.

TAKEOWN Syntax:

Terminal window
takeown [/S system [/U username [/P [password]]]]
[/F filename [/A][/R][/D prompt]]

Options:

OptionDescription
/SSpecifies the remote system to connect to.
/USpecifies the user context under which the command should execute.
/PSupplies the password for the given username.
/FSpecifies the filename or directory.
/AGives ownership to the Administrators group.
/RRecurse: instructs takeown to operate on files in specified directory and subdirectories.
/DSuppresses confirmation prompt.

Parameters:

ParameterDescription
systemSpecifies the remote system to connect to.
usernameSpecifies the user context.
passwordSupplies the password for the specified username.
filenameSpecifies the filename or directory to take ownership of.

TAKEOWN Usage:

Take Ownership of a File

Terminal window
takeown /F C:\Users\JohnDoe\example.txt

Take ownership of the file “example.txt” located at “C:\Users\JohnDoe”.

Take Ownership of a Folder

Terminal window
takeown /F C:\Users\JohnDoe\Documents /R

Take ownership of the folder “Documents” located at “C:\Users\JohnDoe” and all its subdirectories.

Force Ownership Change Without Prompting

Terminal window
takeown /F C:\ProgramData\example.exe /A

Force ownership change of the file “example.exe” located at “C:\ProgramData” without prompting for confirmation.

Take Ownership of a Drive

Terminal window
takeown /F E:\ /R /D Y

Take ownership of the entire E: drive and all its contents, including subdirectories, with the “Y” option for defaulting to Yes for all prompts.

Common Questions on TAKEOWN Usage:

How do I use takeown in Windows?

To use the takeown command in Windows, execute the following command:

Terminal window
takeown /F C:\example\file.txt

Can takeown command be used to take ownership recursively of directories in Windows?

Yes, you can use the takeown command with the /R parameter to take ownership recursively of directories in Windows.

Terminal window
takeown /R /F C:\example\directory

How can I grant ownership to a specific user using takeown in Windows?

To grant ownership to a specific user with the takeown command in Windows, use the /A parameter followed by the username or user ID.

Terminal window
takeown /F C:\example\file.txt /A domain\username

Is it possible to suppress confirmation prompts when using takeown in Windows?

Yes, you can suppress confirmation prompts when using the takeown command by including the /Y parameter.

Terminal window
takeown /F C:\example\file.txt /Y

How do I restore original ownership of a file or directory using takeown in Windows?

To restore the original ownership of a file or directory with the takeown command, use the /D parameter.

Terminal window
takeown /F C:\example\file.txt /D

Can takeown command be used in Safe Mode in Windows?

Yes, you can use the takeown command in Safe Mode in Windows to take ownership of files or directories.

Terminal window
takeown /F C:\example\file.txt

How can I view the help documentation for the takeown command in Windows?

To view the help documentation for the takeown command in Windows, use the /? parameter.

Terminal window
takeown /?

Applications of the TAKEOWN Command

  • You can take ownership of files and folders
  • You can specify multiple files or folders to take ownership of
  • You can take ownership recursively for all subfolders and files within a directory
  • You can specify a specific user or group to take ownership of the files or folders