-2

I run my program, I enter Ctrl+C, obviously I want to stop the program.

But powershell always asks "do you want to stop the program ? (y/N)".

How can I disable this ? I just want the program to stop without this useless prompt.

EDIT : More details

I have a spring boot app, If I run with java -jar and I stop it with Ctrl+C, no prompt.

If I run it with "mvn spring-boot:run", then I stop it with Ctrl+C, I get the prompt. I don't want this prompt.

Solution : replace mvn spring-boot:run with echo y | mvn spring-boot:run

6
  • Why do you want this, and why are you breaking your script? This seems like an x-y situation. You have a problem, came up with a solution, now you need help with that solution.
    – LPChip
    Commented Apr 30 at 9:44
  • Does the prompt say "stop the program" or does it say "terminate the batch job"? Commented Apr 30 at 10:08
  • @u1686_grawity precisely it says "Terminer le programme de commandes (O/N) ?", So yes probably what you are saying would be the right sentence
    – Genku
    Commented Apr 30 at 10:30
  • What's the output of where.exe mvn? Commented Apr 30 at 10:56
  • @u1686_grawity it gives : C:\Users\<myuser>\tools\apache-maven-3.9.6\bin\mvn C:\Users\<myuser>\tools\apache-maven-3.9.6\bin\mvn.cmd
    – Genku
    Commented Apr 30 at 11:23

1 Answer 1

1

The message is not printed by PowerShell – you are running mvn.cmd, a Cmd batch script, and the message is printed by Cmd (the script interpreter) anytime a .cmd or .bat script is Ctrl-C'd.

There is no option to disable the message, other than avoiding the use of .bat/.cmd scripts.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .