Cynosure.X International LLC


Add Comment | Related Links | TrackBack
Related Content

TakeControlOf.cmd (GPL)

A few days ago, I came across, which contained a very small TakeControlOf.cmd batch file. There were only two lines in this simple batch file as shown below.

  takeown /f %1 /r /d y
icacls %1 /grant administrators:F /t

It only takes one parameter on the command-line with no error checking. Nevertheless, it's a very powerful script. So I want to improve it by adding error checking and allowing for multiple command-line arguments. You can download the result below.

TakeControlOf.cmd is a Windows Vista batch program that helps you regain ownership and full permission to any file or directory. You have to be part of the Administrators group in order for this script to work. It's far easier to drag-and-drop files and directories onto this script, then to go through the multi-step security menu for each individual file. You can also run this script on the command-line or in your custom batch files.

TakeControlOf.cmd takes advantage of the SetNumberOfArguments.bat (GPL) script that is available on this web site. So to use this batch file, you'll have to download SetNumberOfArguments.bat, if you don't already have it.

TakeControlOf.cmd is distributed as executable source code under the GNU General Public License. Please see the license agreement elsewhere on this site.


  TakeControlOf.cmd "file/dir 1" [ . . . "file/dir N" ]

Attached File: TakeControlOf.cmd (480 B)

Chieh Cheng
Fri, 25 Jul 2008 00:21:36 +0000

For some reason, this script has difficulty with files in the root directory of any drive on Japanese version of Microsoft Windows Vista. The following error message is reported, but I can't read Japanese.

�G���[: ���݃��O�I�����Ă��郆�[�U�[�ɂ́A�t�@�C�� (�܂��̓t�H���_)
G:\THMPreview.reg: �A�N�Z�X�����ۂ���܂����B
0 �‚̃t�@�C��������ɏ�������܂����B1 �‚̃t�@�C���������ł��܂���ł���

Chieh Cheng
Thu, 25 Sep 2008 15:54:13 +0000

I have just released the TakeControl software for Windows XP and Vista. It does a much better job than this TakeControlOf.cmd batch file that only works on Vista. It seems to operate more consistently across various Windows installations. In addition, you can use it to take ownership of the entire directory content structure.

Chieh Cheng
Wed, 01 Oct 2008 10:21:11 +0000


I tried your scripts after downloading the TakeControl software for XP.

Everything installed fine. However, when I attempted to drag a folder across to remove the weird restrictions in effect, it came up with an error similar to the following:

Smith user not known

I'm sure it's because my girlfriend's account has a space i.e. Jennifer Smith

I am going to try again after creating an admin account with a single name (no spaces) i.e. john

Cheers anyway, let's hope it works. File on disk has weird permissions, which I picked up after doing a backup to external HDD of a friend's PC prior to an XP re-install. I have a hunch it was some dodgy video file.

John Goodwin
Mon, 01 Dec 2008 16:52:10 +0000

Well, I'm pleased to be able to post back here.

Your software did the trick!!

I connected the HDD in question locally, and I was able regain control of the dodgy folders.

Many many thanks. When I had trouble deleting the file/folder from UNIX (on Ubuntu), I knew that the ACL side of Windows would require some 'tweaking'.

Thanks again - you've restored my sanity.


John Goodwin
Mon, 01 Dec 2008 17:26:40 +0000

Add Comment | Related Links | TrackBack
Related Content

Did your message disappear? Read the Forums FAQ.


TrackBack only accepted from WebSite-X Suite web sites. Do not submit TrackBacks from other sites.

Send Ping | TrackBack URL | Spam Control

Title: Strange Access Denied Problem on Windows XP
Weblog: GearHack
Excerpt: I hit a weird access denied problem in Windows XP tonight while backing up files from one NTFS hard drive to another. During the process, random files would report access denied. I basically can't do anything with the file. No copying. No deleting. No renaming. The following is an example on the "Ou . . .
Tracked: Fri, 25 Jul 2008 00:26:09 +0000

Add Comment

Spam Control | * indicates required field
Your Name: *
Remember Me!
Comment: *
File attachment is optional. Please do not attach a file to your submission unless it is relevent.
Attach File:
(20 MB Max)
Spam Protection: * Answer of 4 + 6?
Click button only once, please!

Messages, files, and images copyright by respective owners.

Products | Services
Forums | Latest | RSS
Library | Search | Wiki
Help | Licenses

Login | Register

27 Users Online

Hacking Digital Cameras
Fun for Photographers

Amazon Associate

Copyright © 1996 - 2024. All Rights Reserved.