Page 2 of 2
Re: Batch scripts queueing loop script
Posted: 27 Feb 2013 15:07
by foxidrive
You have a syntax error to begin with.
Re: Batch scripts queueing loop script
Posted: 27 Feb 2013 15:13
by KgOlve
foxidrive wrote:You have a syntax error to begin with.
It was the do() inside a do() command which i put it, wasn't it?
Re: Batch scripts queueing loop script
Posted: 27 Feb 2013 15:19
by Queue
Yes, but it is simply that an IF statement doesn't use DO, DO is part of a FOR statement. DO on its own isn't anything.
foxidrive, what's the purpose of using two find's? Wouldn't [find /c /i "process.exe"] work? I didn't change that in my posts because I assumed you had a reason.
Queue
Re: Batch scripts queueing loop script
Posted: 27 Feb 2013 15:24
by foxidrive
Queue wrote:foxidrive, what's the purpose of using two find's? Wouldn't [find /c /i "process.exe"] work? I didn't change that in my posts because I assumed you had a reason.
Queue
You are right - it does work fine that way. Two finds aren't necessary.
Re: Batch scripts queueing loop script
Posted: 27 Feb 2013 15:28
by KgOlve
This is the final code i ended up with. I just tried it both with none of the processes already running, and by running the batch script 3 times, making the 3rd one queue itself like it was supposed to. It's working wonderfully. Thanks for all the help.
Code: Select all
:queue
for /f %%a in ('tasklist ^|find /i "process.exe" ^|find /c /v "" ') do (
if %%a GEQ 2 (
timeout 60
goto:queue
)
)
Since you're talking about only 1 find being enough, is this how i should write it then?:
Code: Select all
:queue
for /f %%a in ('tasklist ^|find /c /i "process.exe" ^|"" ') do (
if %%a GEQ 2 (
timeout 60
goto:queue
)
)
Re: Batch scripts queueing loop script
Posted: 27 Feb 2013 15:40
by Queue
Code: Select all
:queue
for /f %%a in ('tasklist ^|find /c /i "process.exe"') do (
if %%a GEQ 2 (
timeout 60
goto:queue
)
)
Queue
Re: Batch scripts queueing loop script
Posted: 27 Feb 2013 16:20
by KgOlve
This one works too, thank you very much for all the help.
Problem solved then, i guess