I am experiencing a strange issue with the following batch script run via cmd.exe
on Windows:
@echo off
gradle wrapper
gradlew build
pause
This batch script only ever executes the first command, i.e. gradle wrapper
. After that, the batch script automatically terminates and the command gradlew build
is never executed.
Is there any way I can force the batch script so that it cannot be stopped by gradle wrapper
and continues its execution normally after gradle wrapper
has been called?
If you want the command prompt cmd widnow to stay open after executing the last command in batch file –you should write cmd /k command at the end of your batch file. This command will prevent the command prompt window from closing and you'll get the prompt back for giving more commands in the cmd window.
When echo is turned off, the command prompt doesn't appear in the Command Prompt window. To display the command prompt again, type echo on. To prevent all commands in a batch file (including the echo off command) from displaying on the screen, on the first line of the batch file type: Copy. @echo off.
Ctrl + C should stop a program running from the command prompt, similar to linux.
EXIT /B at the end of the batch file will stop execution of a batch file. use EXIT /B < exitcodes > at the end of the batch file to return custom return codes.
I have a feeling you may need to precede with call:
call gradle…
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With