azer-p
azer-p

Reputation: 282

Pause is not working in bat file after building angular and java

I have this bat script that builds web app and java core. What I want is to build web app then core, but the bat file is closing after building web app. Here's my script

@echo off
echo building webapp.

pause
cd C:\dev\dashboard\dashboard-web
ng build --prod
pause

echo building core.

cd C:\dev\dashboard\dashboard-core
mvn clean package -DskipTests
pause

It close after build web app

Upvotes: 2

Views: 693

Answers (2)

JosefZ
JosefZ

Reputation: 30248

From the Maven on Windows article: You run Maven by invoking a command-line tool: mvn.cmd

Use

CALL mvn clean package -DskipTests

Explanation:

CALL a second batch file

The CALL command will launch a new batch file context along with any specified parameters. When the end of the second batch file is reached (or if EXIT is used), control will return to just after the initial CALL statement.

Upvotes: 2

Kurt Hamilton
Kurt Hamilton

Reputation: 13515

Use the call command to return execution to the parent script.

@echo off
echo building webapp.

pause
cd C:\dev\dashboard\dashboard-web
call ng build --prod
pause

Docs: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/call

Upvotes: 4

Related Questions