Setting file permissions from command line in windows

Problem

You want to modify permissions in Windows from the DOS prompt command line.



Solution

Use cacls

cacls /?


Example


Here are the commands to modify MS Windows/DOS files and directories.

  • Display file permissions. Replace filename with your file name.
> cacls filename...filename            NT AUTHORITYSYSTEM:FPCxxxxxxxxxxxxAdmin:F
  • Modify permissions. Here we are granting full access to the user, replace user with desired user name.
> cacls filename /E /G user:Fprocessed file: C:...filename
  • Here we see the permissions have been reset:
> cacls filename...filename           PCxxxxxxxxxuser:FNT AUTHORITYSYSTEM:FPCxxxxxxxxxxxxxAdmin:F


Reference



Leave a Reply

Your email address will not be published. Required fields are marked *