Don't use a .BAT file but the .CMD file next time. Also consider the solutions we used prior to this new command. More at http://www.robvanderwoude.com/wait.html
As to why, Microsoft was mum about this so you should ask them.
I have a Java program to call a batch file before it's shut down.
I want batch file to wait for Java program to exit first, then run it's staff inside. So I used TIMEOUT 5 as the first line of my batch file.
If I double click batch file to run it, it will wait 5 seconds first, and then start run the following code. But if I call it from the Java program: Runtime.getRuntime().exec("service.bat"); The batch file is not waiting 5 seconds. It's getting executed immediately.
Does anyone know why and how to write code to let batch file wait for a while?