Easier Way to Take Ownership and Grant Access Files or Directories in Vista
In Windows Vista, there are lots of files and directories especially those operating system files plus Windows and Windows\System32 folders have been protected. These protected system files aren’t belong to any users or groups, instead are owned by TrustedInstaller, with even Administrator or Administrators group doesn’t have modify or write access to them. Thus if you intend to manipulate or replace the files, you’ll encounter access denied error even though you are administrator and have disabled UAC or already in elevation mode for the application trying to access.
In this case, users will probably have to right click on the object, then access the object’s properties. Then users have to click on Security tab, click on Advanced button, click on Owner tab, and then perform several clicks and confirmations to take ownership of the object. The whole process have to repeat again to grant read-write-modify or full control access rights to the users. The whole process takes lengthy time, troublesome, involves lots of clicks and steps. To simplify the process, simply download the TakeControlOf.cmd command line batch script, which will automatically take ownership and grant full control access rights by assigning new ACLs (Access Control Lists) to the file or directory that input to the command.
Download TakeControlOf.zip from the forum.
TakeControlOf.cmd makes use of two command-line utilities takeown (takes ownership of a file or directory) and icacls (sets new ACLs on a files or directory) respectively. Full Control access privilege will be given to Administrators group.
To use the batch script, simply launch an elevated command prompt, then run the script. Below is same examples (command should be issued from the directory where you store the TakeControlOf.cmd script):
TakeControlOf C:\Windows\Test_File.exe
TakeControlOf C:\Test_Directory
Note that if you specify a directory, the script will works recursively to include all subdirectories. To change this behavior, edit the TakeControlOf.cmd and remove /r from the takeown (first) line, and /t from icacls (second) line.
Share and contribute or get technical support and help at My Digital Life Forums.
Related Articles
- Add Take Ownership Option To Files and Folders Context Menu in Vista
- Delete Undeletable Files in Windows Vista
- How to Take Ownership and Grant Permissions in Windows Vista
- Change Group Ownership of Symbolic Links in Unix or Linux
- Tips to Slim Down Vista
- iCACLS Vista Command Prompt Tool to Manage ACLs
- Fix Error 80070002 When Using Windows Update in Vista
- Replace Notepad with Another Text Editor (eg. Notepad2 and Notepad++) in Vista
- Hack to Hide and Remove Vista SP1 RC Preview v.258 Evaluation Watermark on Desktop
- Patched user32.dll.mui to Remove Evaluation Copy Text on Desktop of Vista SP1 RC1

































May 25th, 2007 16:07
great tip to hack
May 31st, 2007 04:50
[...] to take ownership and grant full control permissions from command line. Or you can also prepare a Windows shell batch script that easily perform the task by typing simple command. Get help or contribute tips or tricks at My [...]
October 12th, 2007 00:01
The download link for the TakeControlOf.zip is no longer working (at least for me). Has it been taken down?
October 12th, 2007 00:02
Or does anyone know of another script like it?
December 17th, 2007 16:01
[...] This can also happen with real files and folders if your user account information has changed in the new version of Windows. Or you might be trying to access system files. You may be able to fix the problem by taking ownership of the object. You’ll need to be logged on as an administrator to do that. For more on how this works, see “Easier Way to Take Ownership and Grant Access Files or Directories in Vista.” [...]
March 20th, 2008 02:03
THANK YOU SOOOOOOO MUCH. I was foaming at the mouth after I had to buy a new lappie cuz my old one died and when I thought I had to change permissions on every file by hand I was just fuming. It goes to show that the command line is just the most wonderful and conistent and comforting way to get things done.
April 24th, 2008 21:59
[...] can also prepared a Windows shell batch script that automate the process for easy take back the files and folders which is inaccessible and [...]
April 24th, 2008 22:09
[...] two commands have been scripted in Windows command shell batch script that easily perform the task of taking ownership and grant full control permissions to [...]
June 17th, 2008 22:53
does anyone run this and it goes on forever?