Windows command line time limit

command linetimeoutwindows

How might I go about limiting the execution time of a command line program in windows? I know in linux there is timeout/timelimit available, but I have been unable to find similar utilities for windows.

Best Answer

start yourprogram.exe
ping -n 10
taskkill /im yourprogram.exe

If you put this in notepad and save it as .bat it will create a batch file that will do this.

I have used 10 seconds as an example, just tweak to your needs.

Also, if you are using Vista or above you can scrap the ping line and use the much easier timeout command in it's place

timeout /t 10