R
R
Roman Domrachev2011-10-18 17:21:21
cmd/bat
Roman Domrachev, 2011-10-18 17:21:21

Checking file availability in BAT?

It is necessary to check with BAT whether the file is available for assigning the read-only attribute.
I tried using errorlevel (&& including) to check the execution, but alas, changing access rights does not write an error to errorlevel even if the attribute could not be assigned.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Roman Domrachev, 2011-10-18
@MrLoki

@echo off
attrib +R test1.txt |>Nul FindStr /i "ЌҐв ¤®бвгЇ :" && echo "File is denied!"

Looks like he won.

M
mark_ablov, 2011-10-18
@mark_ablov

Is using PowerShell not an option?

D
Dal, 2011-10-18
@Dal

dir/?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question