0% found this document useful (0 votes)
172 views2 pages

Taking Ownership of A File

The document discusses how to take ownership of files and folders in Windows using the command line tools TAKEOWN and ICACLS. It provides the syntax to use TAKEOWN to take ownership of a file or folder, then use ICACLS to grant the Administrators group full control permissions. It also describes some customizations like a Windows command script that simplifies the process, and adding a "Take Ownership" option to the right-click context menu for files and folders using a registry file.

Uploaded by

Vedastus Vicent
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
172 views2 pages

Taking Ownership of A File

The document discusses how to take ownership of files and folders in Windows using the command line tools TAKEOWN and ICACLS. It provides the syntax to use TAKEOWN to take ownership of a file or folder, then use ICACLS to grant the Administrators group full control permissions. It also describes some customizations like a Windows command script that simplifies the process, and adding a "Take Ownership" option to the right-click context menu for files and folders using a registry file.

Uploaded by

Vedastus Vicent
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Taking ownership of a file Open an elevated Command Prompt window.

To do so, click Start, click All Programs, click Accessories, right-click Command Prompt, and then click Run as Administrator. Type the following command and press ENTER: TAKEOWN /F <filename> (Replace the text <filename> with the full path of the actual file.) If the operation was successful, you should see the following message: "SUCCESS: The file (or folder): "filename" now owned by user "Computer Name\User name"." Then to assign the Administrators group Full Control Permissions for the file, you may use the ICACLS command. Use this syntax: ICACLS <filename> /grant administrators:F Taking ownership of a folder Use the following syntax: takeown /f <foldername> /r /d y Then to assign the Administrators group Full Control Permissions for the folder, use this syntax: icacls <foldername> /grant administrators:F /T The /T parameter is added so that the operation is carried out through all the sub-directories and files within that folder. Command-line help: To know more information about the above commands, run these commands from a Command Prompt window. takeown /? icacls /? Customizations #1 Command Script

To further simplify the process of taking ownership, Tim Sneath of Microsoft provides a .CMD file (Windows Command Script) which takes ownership and assigns Full Control Permissions to Administrators for the directory which is passed as a parameter to the CMD file. For more information, read Tims post Windows Vista Secret #11: Deleting the Undeletable. #2 Add "Take Ownership" command to the Context menu This again uses the special runas verb in Windows 7/Vista, which has been covered many times in this Website (REF runas). via WinMatrix.com Download takeown_context.reg and save to Desktop. Right-click on the file and choose Merge. Click Yes when asked for confirmation. This adds an extended command named Take Ownership in the context menu for files and directories. To access the command, you need to press and hold the SHIFT key down, and then right-click on a file or folder.

Sample Scenario: Lets assume that youre trying to delete a folder for which you dont have permissions (although youre logged in as Administrator) and getting an Access Denied error:

Simply press and hold the SHIFT key down, and right-click on the folder that you want to delete. Click the Take Ownership command. You should now be able to delete that folder!

You might also like