如何在 Windows 7 下为进程设置超时? [英] How to set a timeout for a process under Windows 7?

查看:23
本文介绍了如何在 Windows 7 下为进程设置超时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用 Windows 批处理文件启动一个程序.但是程序应该在某个超时值后停止.例如:程序运行 60 秒,60 秒后停止.

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.

在 Linux 下,有一个很好的 timeout 命令来做我想做的事.Windows 也有一个 timeout 命令,但它只是暂停命令,延迟其执行.在 Windows 下还有其他东西可以这样做吗?

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

设置:Windows 7、64 位、专业版

Setup: Windows 7, 64 Bit, Professional

推荐答案

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

这篇关于如何在 Windows 7 下为进程设置超时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆