I want to run a bat file, in which I have two commands to execute sequentially.
@echo off
::taking version no. as input
set /p productVersion="Enter new product version: "
::executing first command
mvn versions:set -DnewVersion=%productVersion% && set /p commitChanges="new version is set for all modules %productVersion% Do you want commit your changes for all pom files :(y/n)" && call:commitChanges %commitChanges%
EXIT /B
::executing second command, after taking input y/n
:commitChanges
If %~1=="y" goto yes
If %~1=="n" goto no
If %~1=="Y" goto yes
If %~1=="N" goto no
EXIT /B
:no
mvn versions:revert
EXIT /B
:yes
mvn versions:commit
EXIT /B
first command executes successfully and line taking input for second command comes,but terminal gets closed and second command is not executed.