Download script to take ownership and grant Administrators full control access from command prompt

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 attachment.
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.