Solved

Help with Batch File to run a program for a specific length of time

Posted on 2011-09-15
3
311 Views
Last Modified: 2013-12-04
I am trying to create a batch to run a program for a specific length of time, then kill the program and restart it.  My batch file so far is:

:start
taskkill /f /im pandora.exe                                   (if pgm running, kill it)
ping -n 10 -w 1000 127.0.0.1 > nul                     (wait a specified time before restarting)
c:\progra~1\pandora\pandora.exe                     (starts or restarts the program)
ping -n 10 -w 1000 127.0.0.1 > nul                     (wait a specified time then loop the batch file)
goto start

The batch file works fine until it starts the program.  The program runs fine, but never goes to the next line in the batch file to start the timer to begin the loop to stop the program again.

Any ideas?
0
Comment
Question by:gboo19
  • 2
3 Comments
 
LVL 30

Accepted Solution

by:
Zoppo earned 500 total points
ID: 36542926
Hi gboo19,

you can use 'start' command, i.e.:
start c:\progra~1\pandora\pandora.exe

Open in new window

If it's a console program and you want to supress the new created DOS window you can add a '/B' like i.e.:
start /B c:\progra~1\pandora\pandora.exe

Open in new window

Hope that helps,

ZOPPO
0
 

Author Closing Comment

by:gboo19
ID: 36542954
Perfect!  Exactly the fix i needed.  Thanks!
0
 
LVL 30

Expert Comment

by:Zoppo
ID: 36543049
You're welcome - I'm glad I could help.

Have a nice day,

best regards,

ZOPPO
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

759 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now