我正在努力在类 Unix 环境中模拟一些命令。我使用的是 Windows 10,并使用 GitBash 的 shell 来运行命令,但 chmod 似乎没有保留文件的权限更改。
zecuse MINGW64 ~ (dev)
$ touch test
zecuse MINGW64 ~ (dev)
$ ls -l test
-rw-r--r-- 1 zecuse 1049089 0 Nov 13 13:30 test
zecuse MINGW64 ~ (dev)
$ chmod -c -r test
mode of 'test' changed from 0644 (rw-r--r--) to 0200 (-w-------)
zecuse MINGW64 ~ (dev)
$ ls -l test
-rw-r--r-- 1 zecuse 1049089 0 Nov 13 13:30 test
Run Code Online (Sandbox Code Playgroud)
Windows 是否会阻止我以这种方式更改文件权限?如果是这样,我是否需要使用powershell来修改文件的权限?
小智 2
等价于chmod
将是icacls
请参考——
https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/icacls
如果chmod 0200
- 用户写权限
尝试使用 cmdprompt
或 PowerShell
icacls test1 /grant User1:(w)
归档时间: |
|
查看次数: |
16457 次 |
最近记录: |