Monday 15 February 2010

batch file - Keep X instances of Y running at all time, windows -


How can I make sure with the batch script that I always run an ex example of cmd.exe for example?

I have searched and found that it gives me NBR X lines if X is running.

  tasklist / FI "IMAGENAME eq exe.exe" 2 & Gt; NUL |   

And then START XXX X has stopped running any one, then Find / Find / I / n "exe.exe"?

how about

  set PROG = exe.exe set COUNT = 0 set = 5 want / f "skip = 1" %% i IN (get wmic process name where name = "% PROG%") (if / i %% i% PROG% set / one COUNT + = 1 is the same) Exclamation count: %%% %% (% 1%,% WANT%) %% of WANT% gtr %% of% /%>% /% / html>

No comments:

Post a Comment