I am essentially looking for this solution 'timeout a command in bash without unnecessary delay', but it must be for a
script.bat
file.
Given a cmd.exe
terminal.
And we start "long-running" /path/to/long-running
program.
And we set a timeout /t 600 /nobreak
to give the program time to run.
After which we taskkill /F /FI "WINDOWTITLE eq long-running"
to stop the program.
When the program ends earlier than 600s, say after 120s.
Then the script must terminate early without waiting for the timeout to reach 600s.
How can we terminate the script at the earlier of the two? [ timeout elapsed / early termination ]