Windows – Running multiple instances of a Batch file in windows simultaneously

batchbatch-filewindows

I have a windows batch file that is invoked by windows scheduler. When I try to have multiple windows scheduler tasks trying to run the batch file simultaneously, the batch file is locked by the first process and the all the other instances fail.

Is there is way in Windows to run multiple instances of batch file simultaneously?

My script is a simple one all it does is:

set java_classpath
java javaClass

Best Answer

The locking of the batch file/process from Task Scheduler is by design in Windows as you can produce some really unwanted results by trying to execute one command before the other is finished. You could however do the opposite/reverse of this and have multiple batch files that have these commands

set java_classpath java javaClass

that get called by one batch file. To do this, you would create a batch file that calls the other ones you created that have the code above. Please see this site for a good reference. I've done similar things with Command Prompt and automated XML-answer file Microsoft Office installs.