Remove readonly attribute from directory

前端 未结 8 1091
情歌与酒
情歌与酒 2020-12-01 06:23

How can I programatically remove the readonly attribute from a directory in C#?

8条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-01 06:52

    If you're attempting to remove the attribute of a file in the file system, create an instance of the System.IO.FileInfo class and set the property IsReadOnly to false.

            FileInfo file = new FileInfo("c:\\microsoft.text");
            file.IsReadOnly = false;
    

提交回复
热议问题