I need to check whether a file is created and locked or not, using a batch file, if the file is locked the program should wait and check periodically whether the file is released from lock, and when it gets unlocked the program should exit.
I am very new to writing batch files (started today)
This is what I have tried:
@echo off
:loop
if (2<nul (>>test.txt echo off))(
goto END
)
else (goto MESSAGE)
:MESSAGE
echo trying to access file
goto loop
:END
pause