1
I have a need to keep a task running all the time which calls a batch file that is pinging a host to cause a delay before a secondary batch file is called. I have configured it to run each time the system starts however this does not keep the task running. Is there way to achieve this and if so how?
Why not configure it to run every x minutes/hours? Also, can you elaborate on what it is you're trying to do exactly? Maybe there's a better way of achieving the same result. – Karan – 2012-10-02T19:20:22.547
1
You want to look into setting up a system service if you want a process to run all the time and be restarted if it dies. If you just want to run something periodically, used Scheduled Tasks. You might also wish to share some more about your goal (whatever the secondary batch file does), because this sounds a lot like an XY Problem
– Darth Android – 2012-10-02T19:20:49.193@Karan - The first batch file pings a host e.g. 127.0.0.1 twice with a delay of 6 seconds and once it completes, it calls a secondary batch file that goes through a sequence of events e.g. copy, move, delete, etc. The intention is that each time a person places a file in a directory, the aforementioned sequence of events kick of automatically. – PeanutsMonkey – 2012-10-02T19:24:02.247
@Darth Android - I did look at setting up a system service however could not find a resource that described how to set up a system service that calls a batch file. First time I ever heard of the use of a XY problem. – PeanutsMonkey – 2012-10-02T19:24:46.270
@PeanutsMonkey In this case, I would recommend asking your "X" question as a new question here if it's not already answered: "How can I execute a batch file every time a user modifies any file inside of a folder?" Using timed batch files seems kludgy, and you might find a better answer. (Quick search shows that it's been answered for linux and OSX, so a question/answer on how to do it with Windows would be a valuable addition to [SU]) – Darth Android – 2012-10-02T19:55:20.177