我想知道是否有办法使用批处理脚本检查单个文件是否具有只读属性。 类似于:如果文件是只读的 echo只读!
我尝试过以下但无济于事:
set ATTRIBS=%%~aF
set CURR_FILE=C:\a.txt
set READ_ATTRIB=!ATTRIBS:~1,1!
if !READ_ATTRIB!==- (
@echo !CURR_FILE! is read-write
) else (
@echo !CURR_FILE! is read only
)
谢谢, 晒。