home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch.nt      Fun with Windows NT batch files      68,980 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 66,987 of 68,980   
   novice to novice   
   Re: Tasklist and PID   
   29 Jul 17 21:49:11   
   
   From: novice@invalid.fi.inv   
      
   I found a solution. This batch work;   
      
   @echo off   
   setlocal enableextensions   
   :start   
   timeout /t 600   
   tasklist | find/i "4952" >nul   
   if %errorlevel% EQU 0 goto found   
   echo Not running   
   goto notfound   
   :found   
   echo Running   
   goto start   
   :notfound   
   echo call c:\bat\second.cmd   
   :eof   
      
      
   "novice"  wrote in message   
   news:62_eB.740$mh1.312@uutiset.elisa.fi...   
   > Hello   
   >   
   > I need help, I don't know, how to do this.   
   >   
   > I have a batch what running long time and I don't want to watch when it   
   > stop and I want to run another batch after that first batch stop, I think   
   > to make another batch, what use tasklist command.   
   >   
   > (I know, I can start two batch like this first.cmd & second.cmd, but this   
   > situation are when first is already running and you want to run second   
   > batch after first and you don't want to cancel first batch).   
   >   
   > Command example; Tasklist /NH /FI "pid eq 4952" found that specific batch,   
   > what is running. It's use robocopy, so I cant use imagename with tasklist,   
   > because next batch will use robocopy too. I want to create batch, what   
   > check if this specific PID running. If it's running, nothing happend. If   
   > this PID is not found anymore, I want to start second batch.   
   >   
   > Example;   
   > @Echo off   
   > :start   
   > timeout /t 600   
   > tasklist /NH /FI "pid eq 4952"   
   > "something if or loop trick here or little bit earlier, what check is that   
   > PID running"   
   > if running => goto start   
   > call second_batch.cmd (if specific PID is not running, that call will be   
   > executed)   
   > :end   
   >   
   >   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca