Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows batch: analogue for `timeout` command

I'm trying to find out how to limit a program execution time within a Windows batch file. Is there something like Unix timeout command? Please advise.

like image 861
Maksym Polshcha Avatar asked Jul 02 '26 06:07

Maksym Polshcha


2 Answers

To limit the time a program has to run you could do something like this

start yourprogram.exe
timeout /t 10
taskkill /im yourprogram.exe /f

That starts yourprogram.exe, waits 10 seconds, then kills the program.

like image 106
Bali C Avatar answered Jul 05 '26 00:07

Bali C


I just installed Cygwin and use unix-style timeout command from the distribution.

like image 43
Maksym Polshcha Avatar answered Jul 05 '26 00:07

Maksym Polshcha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!