Software >> OS >> Windows >> How to set file ownership using command line

Use setowner.exe from NTSEC utilities setowner -r -addpriv <domain\username> <path> -r is for recursion into subdirectories and files in them -addpriv allows granting of permission to the specified user Use subinacl.exe from w2k resource kit 1. To set ownership of file(s) subinacl /file <filepath> /setowner=domain\username eg. subinacl /file c:\temp\test.txt /setowner=CONTOSO\John 2. To set ownership of folder tree subinacl /subdirectories <folder_path> /setowner=domain\username eg. subinacl /subdirectories c:\temp\l1\ /setowner=CONTOSO\John subincal /subdirectories c:\temp\l1\* /setowner=CONTOSO\John