CoTTon
Registered User
- Joined
- Jun 11, 2011
- Messages
- 964
Hey guys
so I currently have this :
I want to be able to have a slight delay - when it opens each program back up - eg: 10 seconds each process
EG: opens 4 - have 3 crash - so the script will reopen 3 back, but then there is 10 seconds delay between each program being reopened.
so I currently have this :
Code:
<code>setlocal enableextensions enabledelayedexpansion
rem what to open
set "_process=notepad.exe"
set "_keep=4"
rem infinite loop: from 0 to 1 in steps of 0
for /l %%a in (0 0 1) do (
rem get count of started processes
for /f %%b in ('tasklist ^| find /c /i "%_process%"') do if %%b LSS %_keep% (
rem start as many processes as needed
set /a _started=%%b+1
for /l %%c in (!_started! 1 %_keep%) do (
start "" "%_process%"
)
)
rem wait
timeout /t 3 > nul
)</code>
I want to be able to have a slight delay - when it opens each program back up - eg: 10 seconds each process
EG: opens 4 - have 3 crash - so the script will reopen 3 back, but then there is 10 seconds delay between each program being reopened.