Bat to finalize process and close application on desktop

Asked

Viewed 2,332 times

2

In the company that works we have an application called Socket developed in java to run files in the browser, but I need a bat to kill the process and close the icon of the application and start it again, but it does not accept to stay with 2 socket open, i managed to make it kill the process and start it again, but when it starts from the error of staying with two socket open, I need a bat to close the icon and when initialize open again, this icon is next to the taskbar next to the speaker, I hope I explained it correctly.

@echo off
taskkill /F /IM conhost.exe (nome do processo)
C:\SOCKET\ExecuteAppCaixa.jar (caminho para abrir)
pause

inserir a descrição da imagem aqui

  • You use a file mechanism to not have two instances of SOCKET?

1 answer

1

Actually it’s not two processes that are open on the clock side, but the Explorer that keeps the icons as if the two were open, but actually has only one.

So far the only way to make the process icon that is no longer active disappear is by placing the mouse pointer on top of the icon or restarting the Explorer with the following commands:

taskkill /F /IM explorer.exe
explorer.exe

or just:

tskill explorer

Note: In your file has at the end the command pause that makes it necessary for the user to press any button to exit the screen, if you want to put the command to be executed by a scheduled task or even manually without the need to see the return of each command, it would be good to remove the pause so that the screen is not open, if it is running in the task scheduler in a hidden way to the user the process cmd.exe will remain open without need.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.