Solved

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

Posted on 2011-09-15
3
312 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 31

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 31

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

911 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

17 Experts available now in Live!

Get 1:1 Help Now