I was wondering if there's a way to check whether a single file has a read-only attribute using a batch script. Something like: if file is read-only echo read-only!
I've tried the following but to no avail:
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
)
Thanks, Shai.