bat文件暂停5秒的代码是什么

2025-02-24 18:12:33
推荐回答(3个)
回答1:

@echo off&del D:\1.txt&ping /n 5 127.1>nul&del D:\2.txt&ping /n 5 127.1>nuldel D:\3.txt

要用ping命令ping -n 5 127.1>nul 这个5就是5秒,时间是有误差的不是很准!

上面的写法多了2个ping命令,下面用一个ping 命令就可以作出你想要的效果~

@echo off&del D:\1.txt&call:1&del D:\2.txt&call:1&del D:\3.txt&call:1
:1
ping /n 5 127.1>nul

回答2:

@echo off
ping /n 1 /w 5000 1.0.0.1>nul
::命令写在下面就是
calc

精确5秒

回答3:

直接
timeout /t 5
即可。