1

Topic: Closing Bat of application by other Batnikom (*.Bat)

Kind time of days!
there is an application which works through a bat-file (it is not launched, namely works in it), and it is necessary for closing other bat-file, or to restart it with the fact of the full closing (at a bat-file there are adjustments which are necessary for nullifying).
Application is launched in a bat-file and in the manager of tasks is displayed as process cmd.exe.
Taskkill can complete application inside , but the window and process in the manager of tasks cmd.exe remains, and it is necessary that at the same time was closed also itself  (as at dagger pushing).
Unfortunately at start 2  the command/f/im taskkill cmd.exe removes it, instead of the first which works with application... As tried on ID process, but it at each new start changes
Actually the first  start.bat (with application):
timeout/t 10
HDZ955FBK4DGI.exe (here any parameters of adjustment of operation of application)
The second  timeout200.bat :
timeout/t 200
start C:\Program files\PHN3\start.bat
timeout/t 20
taskkill/f/im cmd.exe (on this moment I stuck:confused:)
If there are any other working variants, will be glad if offer!

2

Re: Closing Bat of application by other Batnikom (*.Bat)

Astral
Taskkill can complete application inside , but the window and process in the manager of tasks cmd.exe remains
Try in the end  after taskkill to add exit.

3

Re: Closing Bat of application by other Batnikom (*.Bat)

start """C:\Program files\PHN3\start.bat" AND exit

4

Re: Closing Bat of application by other Batnikom (*.Bat)

Probably I a little not correctly stated a essence of a problem, repeated discovery same  after its closing is necessary still
A little changed , now all "administrative processes" are fulfilled in timeout200.bat, start.bat only is responsible for an application launch:
timeout200.bat
timeout/t 200
start C:\Program files\PHN3\start.bat
timeout/t 10
taskkill/f/im cmd.exe
timeout/t 10
start C:\Program files\PHN3\start.bat
start.bat
HDZ955FBK4DGI.exe (here adjustments)
But unfortunately the same result, start.bat is not present restart, for timeout200.bat is closed after taskkill/f/im cmd.exe sad

Kind Baumanets :
Astral
Taskkill can complete application inside , but the window and process in the manager of tasks cmd.exe remains
Try in the end  after taskkill to add exit.

Unfortunately  timeout200.bat launches start.bat then there is a counting 10  and timeout200.bat it is closed. Closing and restart start.bat thus is not present
Itself  (if I correctly wrote all):
timeout/t 200
start C:\Program files\PHN3\start.bat
timeout/t 10
taskkill/f/im cmd.exe AND exit
timeout/t 10
start C:\Program files\PHN3\start.bat

HLD :
start """C:\Program files\PHN3\start.bat" and exit

There is almost the same as well as in 1 a case but after timeout200.bat launches start.bat , timeout200.bat is closed instantly, and without fulfilling a priority - the subsequent closing and restart start.bat
Itself  (if I correctly wrote all):
timeout/t 200
start C:\Program files\PHN3\start.bat AND exit
timeout/t 10
taskkill/f/im cmd.exe
timeout/t 10
start C:\Program files\PHN3\start.bat

5

Re: Closing Bat of application by other Batnikom (*.Bat)

And it is stupid to replace the first  on empty?

6

Re: Closing Bat of application by other Batnikom (*.Bat)

Astral
(If I correctly wrote all)
Do not forget about a key /wait a command start which forces  (command file) to wait execution completions the program launched in this line, and only after that to pass by next line.

7

Re: Closing Bat of application by other Batnikom (*.Bat)

Akina :
And it is stupid to replace the first  on empty?

That is to replace on empty? If you about start.bat:
start.bat (here only 1 line):
HDZ955FBK4DGI.exe (here adjustments)
Then the program will not be launched since in it there are no adjustments

mwz :
Astral
(If I correctly wrote all)
Do not forget about a key /wait a command start which forces  (command file) to wait execution completions the program launched in this line, and only after that to pass by next line.

from/Wait in this case is not present to sense .:
timeout/t 200
start C:\Program files\PHN3\start.bat
timeout/t 10
taskkill/f/im cmd.exe AND exit
timeout/t 10
start C:\Program files\PHN3\start.bat
The program is launched for 2-4 , 10 seconds of an interval more than are enough it, and completions at it as are not present that, can work more than 24 hours, restarting of the program HDZ955FBK4DGI.exe does not help, since it opens in the same opened initially  and old adjustments of the program are saved. For  adjustments it is necessary to restart it with closing start.bat (processes cmd.exe and conhost.exe in the manager of tasks). But since both  have identical titles in the manager of tasks, commands taskkill/f/im <cmd.exe or conhost.exe> lead to closing both, and without giving possibility to continue its performance up to the end...
Problem only in 4 to a line:
1) timeout/t 200
2) start C:\Program files\PHN3\start.bat
3) timeout/t 10
4) taskkill/f/im cmd.exe AND exit
5) timeout/t 10
6) start C:\Program files\PHN3\start.bat
It is necessary that timeout200.bat completed start.bat and launched it repeatedly, and it during this moment itself is closed. Tried through ID process in the manager of tasks ( taskkill/f/pid <ID process> ), but each time ID changes...
Tried to put exit in 2 and 4 line as advised above and as without it, as a result timeout200.bat and could not fulfill all 6 points

8

Re: Closing Bat of application by other Batnikom (*.Bat)

Astral
I still cannot understand, for what here two . There would be one - there would be no also a question with closing-nezakryvaniem.
start.bat, which of a line "HDZ955FBK4DGI.exe (here adjustments)", whether permanently changes that? Why it is impossible to import this line to the first and unique ?
Well or to leave from  somewhere in the graphic interface. To write in what got (though in Delphi) or in what be able the program-cover that was able to launch, restart and close only the console program HDZ955FBK4DGI.exe. And to close itself at the same time.

9

Re: Closing Bat of application by other Batnikom (*.Bat)

Astral
That is to replace on empty? If you about start.bat:
start.bat (here only 1 line):
HDZ955FBK4DGI.exe (here adjustments)
Then the program will not be launched since in it there are no adjustments

You would already be defined, what it is necessary to you, and? If to change  on empty is not shorter old on performance of the last command already executed at the moment of substitution performance  stops. If it is necessary also executable process to remove, without waiting its completions - so it absolutely other task. And, by the way,  CMD it does not solve...

10

Re: Closing Bat of application by other Batnikom (*.Bat)

@echo off
timeout/t 200
tasklist/v/fi "IMAGENAME eq cmd.exe" |findstr "mytitle"> Nul || (
start "mytitle" "C:\Program files\PHN3\start.bat"
timeout/t 10
)
for/F "tokens=1,2* delims =" %% A in (' tasklist/v/fi "IMAGENAME eq cmd.exe" ') do (echo: %% C|findstr "mytitle"> Nul && set "pid = %% B")
taskkill/PID %pid %
start "mytitle" "C:\Program files\PHN3\start.bat"

11

Re: Closing Bat of application by other Batnikom (*.Bat)

Astral
Vobshchem is application which works through a bat-file ( is not launched, namely works in it ), and it is necessary for closing other bat-file, or to restart it with the fact of the full closing (at a bat-file there are adjustments which are necessary for nullifying).

If I correctly understood a problem, you need to get rid of the selected. Make, that  only started application and it was completed, instead of hung permanently. Then and to close it separately it is not necessary. For this purpose use cmd with a key/C.

12

Re: Closing Bat of application by other Batnikom (*.Bat)

Astral
HDZ955FBK4DGI.exe
The Internet refers on AMD Black Edition AMD Phenom II X4 955... Also what there it is necessary to launch (pen)?
To close other bat-file, or to restart
These are different tasks. The first dares adding exit upon termination of most HDZ955FBK4DGI.exe, executed in a window cmd.exe, time it such slow...
Repeated discovery same  after its closing
... And this second task dares an application launch as service. As a last resort from the first file becomes call the second and it is wrapped in loop. You are really defined, what exactly is required and why-what for.

13

Re: Closing Bat of application by other Batnikom (*.Bat)

HLD :
@echo off
timeout/t 200
tasklist/v/fi "IMAGENAME eq cmd.exe" |findstr "mytitle"> Nul || (
start "mytitle" "C:\Program files\PHN3\start.bat"
timeout/t 10
)
for/F "tokens=1,2* delims =" %% A in (' tasklist/v/fi "IMAGENAME eq cmd.exe" ') do (echo: %% C|findstr "mytitle"> Nul && set "pid = %% B")
taskkill/PID %pid %
start "mytitle" "C:\Program files\PHN3\start.bat"

Thanks big, that searched! Works how it has been conceived smile
I hope that given  still it is useful to someone
Dzhamal ,  did not check yours, but itself precisely such could not write)
All participating in arguing as I express gratitude for found time!