Setting file permissions from command line in windows

[problem]

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

[/problem]

[solution]

Use cacls

cacls /?

[/solution]

[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:F PCxxxxxxxxxxxxAdmin:F
  • Modify permissions. Here we are granting full access to the user, replace user with desired user name.
> cacls filename /E /G user:F processed file: C:...filename
  • Here we see the permissions have been reset:
> cacls filename ...filename           PCxxxxxxxxxuser:F NT AUTHORITYSYSTEM:F PCxxxxxxxxxxxxxAdmin:F

[/example]

If you have found my website useful, please consider buying me a coffee below 😉

Leave a Reply

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