Reputation: 8427
I'm trying to run a batch script that would create a new glassfish domain (v 3.1) and right after the creation it would continue with some administrative tasks, like removing other directories or copying files to the newly-created domain. Problem is, I have to wait until the glassfish intallation script finishes its work. I have tried to create a new window with:
Start /WAIT "" asadmin --user admin --interactive=false create-domain --adminport 4848 --instanceport 8080 --nopassword new_domain
and running some simple commands (like xcopy, rd) after it, in the same .bat file. The problem is, after the asadmin script has finished its work new window does not close, but stays opened and the whole script hangs waiting for the job to terminate. I can close it manually and the script continues its flow, but this solution is not satisfactory. I have even tried to modify the asadmin.bat script to force it to shutdown after creation in this way:
%JAVA% -jar "%~dp0..\glassfish\modules\admin-cli.jar" %* && exit
exit
But it does not help.
Upvotes: 0
Views: 681
Reputation: 343
Use call
rather than Start
call asadmin --user admin --interactive=false create-domain --adminport 4848 --instanceport 8080 --nopassword new_domain
when the jar is done executing, control returns to the batch script.
Upvotes: 0
Reputation: 13857
As the comment already suggested you have to use call
instead of Start
and you don't need that /WAIT
flag:
echo "Start..."
call asadmin --user admin --interactive=false create-domain --adminport 4848 --instanceport 8080 --nopassword new_domain
xcopy something...
// more
Upvotes: 1