00 Votes

Cordova: Batch Script closes automatically

Question by Guest | 2017-09-05 at 11:33

For creating my apps for Android, iOS and Windows Mobile, I am using Cordova. To make my development process faster, I am about to build some Windows scripts that should do some common tasks for me.

Such a script can look like that, for example:

cordova create %DIR% %ID% %NAME%

cd %DIR%

cordova platform add android

This script should first create a new Cordova project and after the creation, the script should change into the project directory in order to add the platform "Android".

When typing those commands to the command line, everything is working like a charm. Strangely, it is not working as BAT-script. The script just breaks after the first  "cordova create" command and even the CMD window closes immediately and automatically so that I cannot see whether there are any error messages. What can I do?

ReplyPositiveNegative
1Best Answer1 Vote

You have to put "call" in front of the "cordova"-commands. When taking your script from above, it should look like that instead:

call cordova create %DIR% %ID% %NAME%

cd %DIR%

call cordova platform add android

With calling the commands in this way, the script should not close automatically and it should process completely.
2017-09-05 at 14:34

ReplyPositive Negative
Reply

Related Topics

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.