Windows – Copy security permissions of one file to another

aclfile-permissionswindows 7

I would like to replicate the permissions of a file to another.
I do not want to copy the data, only the permissions.

For example, I created a new file and want it to have the same permissions as another file that already existed.

You can do it in a few steps with icacls and a text editor.

First you must save the permissions of the original file

icacls C:\test\file1.bin /save perms.txt


you will need to edit the perms.txt file you just created in whatever folder you ran icacls in. The file should look something like this:

file1.bin
D:AI(A;;0x1301bf;;;BU)(A;ID;FA;;;BA)(A;ID;FA;;;SY)(A;ID;0x1200a9;;;BU)(A;ID;0x1301bf;;;AU)


You can ignore all the stuff on the 2nd row, all we care about is the first row. Change the file1.bin to your new filename file2.bin and save the file.

Now you just need to restore the file permissions on the 2nd file, note that we did not include the filename this time. (If you get an error that says "Not all privileges or groups referenced are assigned to the caller." run the program again in an elevated command prompt.)

icacls C:\test\ /restore perms.txt