6

I'm running a maven plugin (this is just a new process) as part of a bat file.The plugin command causes the bat file to exit so the subsequent commands do not run. Is there a command or some other way to prevent the bat file quitting too soon ?

Here is the bat file :

ECHO Updating Version
mvn versions:set -DnewVersion=1.2

ECHO this echo does not occur

Perhaps I could use the 'call' command as referenced in How do you stop a Windows Batch file from exiting early? but I would like to run all of the code within one bat file.

Ross Ridge
  • 38,414
  • 7
  • 81
  • 112
user701254
  • 3,935
  • 7
  • 42
  • 53

3 Answers3

8

If mvn is a batch file, then you need to precede it with a call, or else it will terminate on that line.

Robin Dijkhof
  • 18,665
  • 11
  • 65
  • 116
RonaldBarzell
  • 3,822
  • 1
  • 16
  • 23
0

I would use:

set /p v=Press enter to exit

At the end of your program. This will wait for the user to interact before exiting.

seesharper
  • 147
  • 4
  • 16
-1

Use the PAUSE command.

Pause /?

Example:

@Echo off
Echo hello world
Pause >NUL
exit
ElektroStudios
  • 19,105
  • 33
  • 200
  • 417