4

I am trying to write a very simple batch file to execute gradle commands for my java projects. I have written below script in a batch file and saved as build.bat

cd data-connector
gradle clean build -x test
gradle dist
cd..

Now the .bat file is placed in the correct folder. Trouble occurs as the execution reaches 3rd line of the script. The command prompt just stops on 3rd line, no errors nothing. All the environment variables are correctly set and permissions in place. Please point my mistake here, what I am missing. Why is this script not going beyond the 2nd line of the script.

Mark
  • 3,609
  • 1
  • 22
  • 33
Sushant Gupta
  • 1,487
  • 2
  • 16
  • 23

1 Answers1

12

Try replacing "gradle" with "call gradle" on 2nd and 3rd lines. Your existing invocation calls gradle.bat and never returns.

Reference: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/call.mspx?mfr=true (you don't say which version of Windows you're using, but I think this has been the same for quite some time).

This is also answered here: Executing multiple commands from a Windows cmd script

Community
  • 1
  • 1
Andy McKibbin
  • 784
  • 1
  • 6
  • 21