-batchmode Not Blocking on Command-Line Windows

We are trying to invoke Unity -batchmode on our build server. We’re noticing, when ran from the command line, the command returns immediately (though Unity is still running in the background).

Is there a way to run Unity -batchmode such that it blocks while Unity is executing? We’re currently using Unity 4.1.5f1

Our command:

"C:\Program Files (x86)\Unity\Editor\Unity.exe" -quit -batchmode -nographics -executeMethod BuildAndRunScript.Build

Thanks in advanced.

We have bat script, which we,re running. Inside batch we have:

"C:\Project\Game.exe" -batchmode -nographics

We run this script by double-click and we have window open still and running.

A possible way for handling it is using start command waiting for the termination of Unity process:

start /b /wait "dummy" "C:\Program Files\2018.2.14f1\Editor\Unity.exe" -projectPath C:\Projects\UnityBatchmodeWin -batchmode -quit

Side note: I should use a “dummy” calling because a known bug of the start command; if you have spaces in both, the command or the parameters and try to handle them with quotes, it fails!