Is there a way to run the chmod command on Windows?
9 Answers
No, there's no chmod
command in Windows.
Either use Explorer's properties page for the file, or from a command shell use the attrib
or cacls
commands.

- 21,191
- 3
- 52
- 82
-
-1, attrib.exe has nothing to do with permissions, it changes file attributes. – ThatGraemeGuy Aug 10 '09 at 10:44
-
3sure, but one of those attributes is the read-only permission. – Alnitak Aug 10 '09 at 10:52
-
1That's not a permission, it's a file attribute. The NTFS "write" permission is NOT the same thing as the "R" file attribute. – tomfanning Aug 10 '09 at 10:58
-
1if you know of a decent reference explaining the difference that would be useful. thanks. – Alnitak Aug 10 '09 at 12:23
-
From Windows 7: *NOTE: `Cacls` is now deprecated, please use `Icacls`.* – jscott Sep 16 '10 at 12:32
-
I just add c:\cygwin (assuming that is your install directory) to the environmental variables in Control Panel, System, Advanced, Environmental Variables, PATH – Sun Aug 13 '14 at 22:12
I was going throu the net to get the exact syntax for the same: Found a few HEre is the icacls.exe alternative to chmod 400
Step1: icacls.exe "path+key.pem" /reset
Step2: icacls.exe "path+key.pem" /grant:r "$($env:username):(r)"
Step3: icacls.exe "path+key.pem" /inheritance:r

- 21
- 1
Exactly what do you want to accomplish by using chmod?
Would you be marking some files as executable?
Windows system does not support most (all?) of what chmod
is used to do.
You can change read-only and visibility access recursively from the explorer properties.
I was surprised to see CHMOD-Win
But, do be careful with what you get from such sites.

- 7,100
- 2
- 25
- 30
-
Thanks I did try CHMOD-Win, but that just gives you the numerical values for the file permissions you want to apply to each user group (e.g. 4 = read, etc.). – Techboy Aug 10 '09 at 09:00
-
1In that case you should try the properties from the GUI or the `attrib` command (try "attrib /h" from a command shell). – nik Aug 10 '09 at 09:02
-
Thanks for the help. As it is not possible to run chmod from within Windows, I have asked a separate question (explaining my issue in full) here: http://serverfault.com/questions/52162/windows-file-permissions-comparing-to-chmod – Techboy Aug 10 '09 at 09:20
There are some native Win32 ports of Unix commands available. I believe chmod is included, but depending on what you're actually trying to accomplish this might be the wrong tool to use. Perhaps CACLS could be useful (try "cacls" from the command line or search in the windows help).

- 121
- 1
-
I have just tried it and chmod doesn't appear to be there (unless I'm doing something wrong). I don't think CACLS will help me in this particular scenario, but thanks. – Techboy Aug 10 '09 at 10:32
-
I just downloaded UnxUtils.zip and chmod is located under usr/local/wbin. – rjnilsson Aug 10 '09 at 10:41
In windows 10 powershell I did run the below commands which will be equivalent to chmod
Note: first change the DIR to the folder where you have your .pem file
icacls.exe key.pem /reset
icacls.exe key.pem /grant:r "$($env:username):(r)"
icacls.exe key.pem /inheritance:r

- 1,222
- 3
- 14
- 25

- 11
- 2
On post Win2k OSes one sould use iCalcs instead of the older Calcs.
If you need to set-up website permissions, you can try logging using an FTP client like filezilla and Chmod permissions from there.

- 472
- 3
- 6
Is a console application for windows that can set file premissions ( NTFS file premissions ), and like metioned before attrib can set some limited file attributes.

- 535
- 1
- 5
- 14
Download and install git.
Then
Go to the C drive In Program Files folder, you will find the folder named Git, find usr then bin.
In my case, the location for bin folder was:
C:\Program Files\Git\usr\bin Add this location C:\Program Files\Git\usr\bin to path variables, in system environment variables.
Restart cmd.
Try again

- 4,514
- 22
- 31
- 30