Say I have a batch file for carrying out a long build and at the end it creates an EXE. If I forget to close the app down before I start the build, the link phase fails whe
@echo off
:start
ren filename filename // rename file to same name
if errorlevel 1 goto errorline
echo command successfull file is not in use anymore
goto end
:errorline
echo Rename wasnt possible, file is in use try again in 5seconds
timeout /T 5
goto :start
:end
exit
renames file to the same name, if possible the script jumps to end whichs exit the code, otherwize it produces error code1 and jumps to errorline, after a timeout of 5 seconds it jumps to :start and script starts from beginning.