A few days ago, I came across TakeControlOf.zip, 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
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" ]
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.
エラー: 現在ログオンしているユーザーには、ファイル (またはフォルダ)
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.
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.
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.
Did your message disappear? Read the Forums FAQ.
TrackBack only accepted from WebSite-X Suite web sites. Do not submit TrackBacks from other sites.
Title: Strange Access Denied Problem on Windows XP
Spam Control | * indicates required field
Messages, files, and images copyright by respective owners.
46 Users Online
Copyright © 1996 - 2021. All Rights Reserved.