Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Want to create .cmd or .bat file to spawn a subprocess, wait 10 minutes, kill it and restart it

Posted on 2006-04-21
3
Medium Priority
?
1,255 Views
Last Modified: 2008-11-07
I am hoping to create a .cmd file that has the ability to spawn a subprocess and then continue executing itself such that it has the ability to wait 10 minutes, kill the exe it started and then restart it......

Thanks....
0
Comment
Question by:smmsmm57
  • 3
3 Comments
 
LVL 43

Accepted Solution

by:
Steve Knight earned 1500 total points
ID: 16507520
something along these lines perhaps:

REM start program in background
start myprog.exe

REM wait 10 mins
ping -n 1 -w 600000 AnIpAddressthatWillAlwaystimeout

REM Find process ID (resource kit command)
for /F "tokens=1,2 delims= " %a in ('pulist ^| find "myprog.exe"') DO echo KILL %b

Remove the echo before the KILL to kill the process.

0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 16507529
And a goto start at the end with a label at the start, i.e.


:start

REM start program in background
start myprog.exe

REM wait 10 mins
ping -n 1 -w 600000 AnIpAddressthatWillAlwaystimeout

REM Find process ID (resource kit command)
for /F "tokens=1,2 delims= " %a in ('pulist ^| find "myprog.exe"') DO echo KILL %b

goto start
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 16534408
What's with the b grade?  Did it work for you?
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question