Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have three main applications.

I am trying to start them automatically at log on in a specific order with a given delay.

Here is an example of how I'd like everything to be:

User logs in.

Wait for given delay (say 1 minute to allow other start up items first.)

Run Application 1 Instance 1 w/arguments

Run Application 1 Instance 2 w/arguments

Run Application 1 Instance 3 w/arguments

Run Application 1 Instance 4 w/arguments

Run Application 1 Instance 5 w/arguments

Run Application 2 Instance 1

Run Application 2 Instance 2

Run Application 2 Instance 3

Run Application 3 Instance 1

Run Application 3 Instance 2 w/arguments

Currently I've tried a few different examples.

I've tried using a single Scheduled Task with a single Trigger (At startup with delay) and then a Start a Program action for each Application and Instance (10 Actions in total). The problem with this is the task will only run one application at a time. The application has to close before it moves on to the next and I can't one is closed before starting a new task. This doesn't help as I need all instances to be running at the same time.

I've tried making a scheduled task for each application instance with varying timers to try to start them in that order. This is tedious and doesn't always work in the proper order I want. It's also very difficult to make changes to.

Currently, my "solution" is just to create a batch file that runs everything, and use a delayed scheduled task to run the batch file. This "works" but is not ideal as the task is unable to detect if applications crash or restart them automatically (Application 2 tends to crash on network interruptions.)

Is there any solution to this? I would NOT like to download and install a third party application to handle this.

I am using Windows Vista Home Basic SP2.

share|improve this question
    
Your batch file can easily check whether an app's running and react accordingly. Just posted an answer here that'll help. –  Karan Mar 18 '13 at 6:42

1 Answer 1

This is a two part problem.

1) Restart the application if it fails. You can create a three line script for each application.

:top 
application.exe arg1 arg2 arg3 
IF ERRORLEVEL 1 GOTO top

2) Run the applications in order. This is right up batch's ally, but you will have to use START so that it does not wait for each one to finish before starting the next one (type "start /?" on the command line).

START "App1.1" app1_1.bat
START "App1.2" app1_2.bat
START "App1.3" app1_3.bat
...
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.