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.
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
The script works on all versions of Windows and Windows Server, from Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server 2016 or later.
Update: How to Take Ownership and Gain Full Control Permissions in Windows