I'm quite stuck on this one; I need a batch (most other programtypes are restricted on the system this has to be run on) to run about 10.000 times, then stop.
I got this far with this method: (generalized and simplified here, yet would do the trick to explain stuff with, because the file just clicks a bunch of stuff, just inhumanly fast)
@echo off
set loop=0
:start
echo Hello world.
set /a loop=%loop%+1
if "%loop%"=="10000" goto exit
goto start
:exit
exit
The above code is working, the problem I'm having is the risk. There's a small probability, the program I need this for starts sending keystrokes, which isn't that big of a problem, if the loop wouldn't still be running. The program could crash in a way causing windows to crash, which isn't quite what i need.
So the question I'm asking is:
Is it possible to use something along the lines like if keystrokeinput==anything goto exit
while the loop is running to stop it, or is there another method i could try?
If nothing works maybe a thirdpartyprogram that might do the trick?
I hope my needs and problems are clear
Edit:
The keystroke needs to be checked like systemwide. If the batch needs to be focused/opened and visible, it wouldn't work.
The keystroke needs to be detected from outside of the according cmd, meaning if there is any input to the system.
Thanks in advance
Tim