Installation timeout for commands in a Windows .bat file.

I wrote a windows .bat script. To start the command list, and then turn off the computer.

eg:

c:\someapplication.exe
c:\someapplication2.exe
Shutdown -s -t 0

Sometimes "c: \ someapplication.exe" freezes and does not respond. How do I set the timeout for my c: \ someapplication.exe command so that after some time I want the windows to force the application to close and continue the rest of the commands?

+3
source share
3 answers

You can use a combination of pingand for this taskkill.

start c:\someapplication.exe
ping 127.0.0.1 -n seconds
taskkill /im someapplication.exe /f 
start c:\someapplication2.exe
ping 127.0.0.1 -n seconds
taskkill /im someapplication2.exe /f 
Shutdown -s -t 0 /f

seconds ping , , ( , , , ). , .

+2

, ,

 start someapplication
 start someapplication2
 wait n secons
 shutdown

n, ,

, ,

 start someapplication
 wait n seconds
 start someapplication2
 wait m seconds
 shutdown

wait , google

+3

exe shutdown [-t]. , "start" ( "start [yourProgram.exe]" ). [-f].

+2

All Articles