0

我有这个 bat 文件来杀死和启动文件,但我需要延迟。

TASKKILL /F /IM "file.exe"
(what is the code to delay 1 minute before executing the code below?)
start /d "path" file.exe

你能帮我么?谢谢

4

2 回答 2

2

您可以ping按照@Krister 的建议使用

ping 127.0.0.1 -n 60

如果您使用的是 Vista 及以上版本,您可以使用更容易timeout

timeout /t 60
于 2012-11-22T11:07:08.627 回答
1

我已经使用该ping命令来实现这一点,您可以 ping 一个无效的主机并将该命令的超时设置为您想要的延迟。

@echo off
ping 1.2.3.4 -n 1 -w 60000 >NUL
# this command will be run after 60000ms
echo 'running';
pause
于 2012-11-22T10:11:05.747 回答