Batch scripts queueing loop script
Moderator: DosItHelp
Re: Batch scripts queueing loop script
You have a syntax error to begin with.
Re: Batch scripts queueing loop script
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
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
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
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
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.
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 /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
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
This one works too, thank you very much for all the help.
Problem solved then, i guess
Problem solved then, i guess