据我所知,创建隐藏文件夹的方法是:
创建目录(文件夹名称); SetFileAttributes( 文件夹名称, FILE_ATTRIBUTE_HIDDEN );
这样做会导致目录暂时存在,而不是隐藏的。云软件和备份等其他程序可能会错误地将其视为非隐藏...并对其进行处理。
是否可以在单个 API 调用中实现相同的目的?一个原子步骤?好像应该可以吧! ??
最佳答案
您可以使用 CreateDirectoryEx
为了这。
Creates a new directory with the attributes of a specified template directory. If the underlying file system supports security on files and directories, the function applies a specified security descriptor to the new directory. The new directory retains the other attributes of the specified template directory.
您需要一个具有合适(即隐藏)属性的模板目录。
关于windows - Win - 你能一步创建一个隐藏文件夹吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21640193/