Jump to content

[Essential Tutorial] Takeown Command : Take ownership of files with denied access in Windows


Recommended Posts

If you must access a file or a folder that you do not have rights to, you must first take ownership of that file or folder. When you do this, you replace the security permissions that were originally created for the file or folder.

To do this via Command Prompt you can use the “takeown” command.

A simple example would be:

takeown /f test.txt - which would take ownership of the file test.txt as the current user

In the example below – takeown /f * /r /d y – I have navigated into the parent folder TestFolder to take owner ship of all files and folders (including sub-directories) as the current user, and have specified that I would like to take ownership when prompted.


You should get a message of success for each object this is carried out upon.

There are several useful arguments which can be used with the “takeown” command as demonstrated above.

/s <Computer> – Specifies the hostname or IP address of a remote computer (do not use backslashes). The default value is the local computer. This parameter applies to all of the files and folders specified in the command.

/u [<Domain>]<User name> – Runs the script with the permissions of the specified user account. The default value is system permissions.

/p [<Password>] – Specifies the password of the user account that is specified in the /u parameter.

/f <File name> – Specifies the file name or directory name pattern. You can use the wildcard character * when specifying the pattern. You can also use the syntax ShareNameFileName.

/a – Gives ownership to the Administrators group instead of the current user.

/r – Performs a recursive operation on all files in the specified directory and subdirectories.

/d {Y | N} – Suppresses the confirmation prompt that is displayed when the current user does not have the “List Folder” permission on a specified directory, and instead uses the specified default value.

Y: Take ownership of the directory.

N: Skip the directory.

Note that you must use this option in conjunction with the /r option.

Note: no risk using this command its fully safe.

Difficulty : easy

Edited by emerglines
Link to comment
Share on other sites

  • Replies 3
  • Views 3.6k
  • Created
  • Last Reply

Top Posters In This Topic

  • emerglines


  • sanjoa


  • Bl4ckCyb3rEnigm4


Popular Days

Top Posters In This Topic

Nice tut! Thanks +1

These are the most unknown tutorial that can make you fix your windows without need to reinstall or backup :)

Link to comment
Share on other sites

  • 8 years later...



This is considered a "thank you post".

Thank you post has been removed. Please read the guidelines before posting. https://nsaneforums.com/guidelines/


Like on most online forums the use of the 'Like / Thanks' button is preferred over simply posting 'Thanks' or something similar. Making an excessive amount of posts which add little to nothing to a topic might result in a post count reduction.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...