如何检查单个文件是否具有批量只读属性

时间:2017-05-29 09:27:08

标签: batch-file cmd scripting

我想知道是否有办法使用批处理脚本检查单个文件是否具有只读属性。 类似于:如果文件是只读的 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
)

谢谢, 晒。

0 个答案:

没有答案