How to grant permission to users for a directory or file using command line in Windows?
Posted: Tue Sep 11, 2018 8:35 pm
How to grant permission to users for a directory or file using command line in Windows?
takeown /f <directory name> /r /d y
icacls <directory name>/q /c /t /grant <Users>:F
example to allow deletion of pagefile.sys if you pull the hard drive from a broken pc and attach to another computer
open CMD as administrator
takeown /f pagefile.sys
icacls pagefile.sys /grant administrators:F
takeown /f <directory name> /r /d y
icacls <directory name>/q /c /t /grant <Users>:F
example to allow deletion of pagefile.sys if you pull the hard drive from a broken pc and attach to another computer
open CMD as administrator
takeown /f pagefile.sys
icacls pagefile.sys /grant administrators:F