gpt4 book ai didi

ruby - 如何在 Windows 上更改文件权限?

转载 作者:可可西里 更新时间:2023-11-01 10:25:01 26 4
gpt4 key购买 nike

如何以编程方式将文件的权限更改为可写?

输入的是只读文件,想知道有没有通用的方法可以保证无论是什么版本的Windows(XP,server-2003)都可以打开可写/关闭只读, 或更高)。

最佳答案

Windows 中的只读属性设置为 attrib command .

exec "attrib +R 12345.jpg" #sets the read-only file attribute
exec "attrib -R 12345.jpg" #removes the read-only file attribute

关于ruby - 如何在 Windows 上更改文件权限?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20529224/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com