Computer Hope

Microsoft => Microsoft Windows => Windows Server => Topic started by: babloo on December 23, 2013, 08:06:43 AM

Title: Batch request
Post by: babloo on December 23, 2013, 08:06:43 AM
Hi I am not good with creating batch, I need assistance creating one. Everytime my application crashes it leaves a log file, using that LOG file I want to restart the application by killing all processes first and then execute them again. If possible please help.

Here is what I need.

I want to create a batch which I will schedule to run every 1 minute or 2, it will check and do following:

1. Check if C:\MyFolder\Myfile.txt Exist  <-- This is the trigger if log file is generated meaning the application got crashed, must get restarted.
2. If TRUE then kill all process named as MyApplication.exe (There are atleast 4 - 5 instances running, I want to terminate all)
3. Once terminate then run three instances.
4. Run 1st instance "C:\Program Files (x86)\Application\application.exe" FirstInstance Parameters - Wait for 60 seconds
5. Run 2nd instance "C:\Program Files (x86)\Application\application.exe" SecondInstance Paraameters  - Wait for 60 seconds
6. Run 3rd instance "C:\Program Files (x86)\Application\application.exe" ThirdInstance Parameters - Wait for 60 seconds
7. Delete C:\MyFolder\Myfile.txt
Exit

When I say Parameters my application has three different shortcuts on desktop when we execute, each have different parameters something like:

"C:\Program Files (x86)\MyApplication\Application.exe" SYS=PROD ATP=NPL 

Thanks alot
Babloo
Title: Re: Batch request
Post by: babloo on December 23, 2013, 11:24:27 AM
Nevermind managed to create the batch to full fill the requirements.

Thank you.