I have an application on Windows Server 2008 that takes different command-line parameters. For example:

myapp.exe /A

myapp.exe /B

I have created a task scheduler task for each of those.

While "myapp.exe /A" is running, I want to prevent another instance of it from starting. However, I still want "myapp.exe /B" to be able to run (again, though only one instance of it at a time).

How can I set this up?

  • What version of Windows Server are you looking at? Nov 12, 2013 at 1:26
  • Windows Server 2008. Updated question.
    – Dan C
    Nov 12, 2013 at 2:03
  • 1
    This seems to be not so much a task scheduler question as to how to prevent two instances of the app running at the same time. Task Scheduler will attempt to launch whatever app you try to schedule at a particular time. Any process collision detection required would need to be implemented by you. E.G Write a flag file that is deleted at the end of job running or run a command to check if the process is already running and if not, run the second command etc.
    – Enigman
    Nov 12, 2013 at 3:09
  • @Enigman, I was hoping that there was something in Task Manager that could handle this, but so far it does indeed look like I need to allow Task Manager to run parallel copies of the app/task and have the app itself do the collision detection (using a named system mutex comes to mind).
    – Dan C
    Nov 12, 2013 at 4:51


You must log in to answer this question.

Browse other questions tagged .