Windows batch: analogue for `timeout` command

前端 未结 4 1568
不思量自难忘°
不思量自难忘° 2021-01-06 14:26

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.

4条回答
  •  臣服心动
    2021-01-06 14:47

    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.

提交回复
热议问题