Search code examples
windowsbatch-filewindows-7timeout

How to set a timeout for a process under Windows 7?


I would like to start a program with a Windows batch file. But the program should stop after a certain timeout value. For example: Run the program 60 seconds and stop it after 60 seconds.

Under Linux, there is this nice timeout command to do what I want. Windows has also a timeout command, but it's just to pause a command, to delay it's execution. Is there something else under Windows to do so?

Setup: Windows 7, 64 Bit, Professional


Solution

  • start yourprogram.exe
    timeout /t 60
    taskkill /im yourprogram.exe /f