0

I am trying to set an ini file as a system file but before I do this I want to make it hidden. I want to do this because I want no one to be able to see it even if they have hidden files enabled (so that they can see hidden files). But when I set the file to hidden and then set it to system it removes the hidden attribute and makes it system only. I have also tried setting it hidden manually and then setting it system via my program but it doesn't work.

The code I am using is simply just this:

File.SetAttributes(settingsDir, FileAttributes.Hidden)
File.SetAttributes(settingsDir, FileAttributes.System)

Thanks.

4

1 回答 1

1

属性不累积:

File.SetAttributes(settingsDir, FileAttributes.Hidden)
File.SetAttributes(settingsDir, FileAttributes.System)

第一个设置为隐藏,然后设置为系统。做这两个:

File.SetAttributes(settingsDir, FileAttributes.Hidden OR FileAttributes.System)
于 2013-10-26T13:33:04.960 回答