BOOL SetFileAttributes( LPCTSTR lpFileName, // address of filename DWORD dwFileAttributes // address of attributes to set );FILE_ATTRIBUTE_ARCHIVE The file is an archive file. Applications use this value to files for backup or removal. FILE_ATTRIBUTE_HIDDEN The file is hidden. It is not included in an ordinary directory listing. FILE_ATTRIBUTE_NORMAL The file has no other attributes set. This value is valid only if used alone. FILE_ATTRIBUTE_OFFLINE The data of the file is not immediately available. Indicates that the file data has been physically moved to offline storage. FILE_ATTRIBUTE_READONLY The file is read-only. Applications can read the file but cannot write to it or delete it. FILE_ATTRIBUTE_SYSTEM The file is part of the operating system or is used exclusively by it. FILE_ATTRIBUTE_TEMPORARY The file is being used for temporary storage. File systems attempt to keep all of the data in memory for quicker access rather than flushing the data back to mass storage. A temporary file should be deleted by the application as soon as it is no longer needed.如:SetFileAttributes(PChar(C:\1.txt), FILE_ATTRIBUTE_NORMAL)
FileSetAttr 设置指定文件的属性
LPCTSTR lpFileName, // address of filename
DWORD dwFileAttributes // address of attributes to set
);FILE_ATTRIBUTE_ARCHIVE The file is an archive file. Applications use this value to files for backup or removal.
FILE_ATTRIBUTE_HIDDEN The file is hidden. It is not included in an ordinary directory listing.
FILE_ATTRIBUTE_NORMAL The file has no other attributes set. This value is valid only if used alone.
FILE_ATTRIBUTE_OFFLINE The data of the file is not immediately available. Indicates that the file data has been physically moved to offline storage.
FILE_ATTRIBUTE_READONLY The file is read-only. Applications can read the file but cannot write to it or delete it.
FILE_ATTRIBUTE_SYSTEM The file is part of the operating system or is used exclusively by it.
FILE_ATTRIBUTE_TEMPORARY The file is being used for temporary storage. File systems attempt to keep all of the data in memory for quicker access rather than flushing the data back to mass storage. A temporary file should be deleted by the application as soon as it is no longer needed.如:SetFileAttributes(PChar(C:\1.txt), FILE_ATTRIBUTE_NORMAL)
比如
attrib -r c:\新建文件夹\test.txt
要实现改变文件夹只要把文件地址改为文件夹地址就行
attrib -r c:\新建文件夹把代码写入txt文档后缀改为.bat就可运行
attrib +r c:\新建文件夹
写错了,不好意思啊