Home > database >  How to close java desktop application from .bat file
How to close java desktop application from .bat file

Time:11-16

I have a java stand alone application. I build a jar, and I create a .exe file from this jar file.

Then I can start the application by double click on it. Now I need to create a .bat file to close the exe program. Now I build a .bat file like this:

TASKKILL /F /PID easyManagement.exe
pause

the script is executed without error but the program easyManagement is every time on.

EDIT In task manager I can display my program like this: enter image description here

This code:

TASKKILL /IM easyManagement.exe

run without error but the application is on every time.

CodePudding user response:

You are using a wrong parameter for the taskkill command.
The /PID expects a pid and not the name of the program you want to stop.
Use TASKKILL /IM easyManagement.exe
or TASKKILL /F /IM easyManagement.exe to force the program to stop.
The /F might cause problems in the program you want to stop.

CodePudding user response:

The keys Ctrl C and Ctrl Z will end the running of a batch file. Check out this link: Is there a way to write Ctrl-C in a batch file?

  • Related