Execute the following code bat
:
taskkill /F /IM ACCA.exe
ping 127.0.0.1 -n 10
start c:\exe\ACCA.exe
The ping
serves as a sleep
( I did not find the function of Sleep in the bat
) for some cases of applications that are heavy and need a certain time to finish all their services, the parameter -n 10
indicates that the system should ping the ip(you can use another ip) an amount of 10 times before opening the executable again.
@Edited
I used the command timeout /t 10
quoted in the reply edited of Laércio to replace the command ping
(used only for waiting for the full completion of the desired application) and worked, you can replace the line ping 127.0.0.1 -n 10
by command timeout /t 10
In case you want to wait 10 seconds (besides that you can end the waiting by pressing any key), rasoável time to my view to finish any application. I recommend using the timeout, since the ping was not actually done to pause the execution. It is up to you to use the ping
or the timeout
.
Note: I don’t know why, but in talking to Bulfaitelo in Chat, we saw that when creating an executable Shortcut c:\ACCA\ACCA.exe
and add the path of this shortcut to the command start
, the command worked as expected.
If you put one below the other in the same bat doesn’t work?
– Wictor Chaves
@Wictorchaves already tried it just doesn’t open, it seems that it only runs the first line.
– Bulfaitelo
If you need to restart it probably it is not responsive... after Kill, how long it takes to die?
– Leandro Angelo
@Bulfaitelo I’m waiting for you in chat...
– RXSD