?
Solved

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

Posted on 2011-09-15
3
Medium Priority
?
329 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 31

Accepted Solution

by:
Zoppo earned 2000 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

777 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