中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-11 02:40
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » In batch processing, pause for 1 - 2 seconds
Printable Version  1,733 / 8
Floor1 kyswzm Posted 2005-10-04 11:14
新手上路 Posts 5 Credits 15
@echo off
rem Wait here for 1-2 seconds (not waiting for a key press), or you can add a boring long loop here.
del nwpt2005.Exe
ren xnwpt2005.exe nwpt2005.Exe
Start nwpt2005.Exe
del shengji.bat
The operating system is XP, please! Please!

---------- Edited by willsort ----------
Modified original title: Newcomer, seeking help with a batch statement!
---------- Edited by willsort ----------


[ Last edited by willsort on 2005-10-4 at 22:00 ]
Floor2 Michael Posted 2005-10-04 11:19
钻石会员 Posts 3,041 Credits 10,056
Floor3 kyswzm Posted 2005-10-04 11:22
新手上路 Posts 5 Credits 15
Thanks, senior! Please give me specific details!
CHOICE /T 2 It doesn't seem to work. Is it that the XP operating system doesn't support this command, or...

[ Last edited by kyswzm on 2005-10-4 at 11:30 ]
Floor4 chujiafu Posted 2005-10-04 11:43
银牌会员 Posts 595 Credits 1,339 From 安徽 宿州
Really don't understand what the original poster means
Floor5 kyswzm Posted 2005-10-04 12:07
新手上路 Posts 5 Credits 15
It's just that in the instructions, the batch processing delays for 2 seconds!
Floor6 kyswzm Posted 2005-10-04 12:11
新手上路 Posts 5 Credits 15
What you want to do is implement a pause in a batch file for a few seconds without waiting for a key press. In DOS batch, you can use a loop to achieve a simple delay. Here's an example of how to modify your batch file:

```batch
@echo off
rem Use a loop to create a delay of about 2 seconds
set "count=0"
:loop
timeout /t 1 /nobreak > nul
set /a count+=1
if %count% lss 2 goto loop
del nwpt2005.Exe
ren xnwpt2005.exe nwpt2005.Exe
Start nwpt2005.Exe
del shengji.bat
```

Note that the `timeout` command is available in Windows 2000 and later systems. If you are in an environment where `timeout` is not available, you can also use a more primitive method like:

```batch
@echo off
rem Use a loop to create a delay of about 2 seconds
for /l %%i in (1,1,20) do (
ping -n 1 127.0.0.1 > nul
)
del nwpt2005.Exe
ren xnwpt2005.exe nwpt2005.Exe
Start nwpt2005.Exe
del shengji.bat
```

This second method uses the `ping` command to create a delay. Each iteration of the loop pings the local loopback address once, and doing it 20 times approximates a 2-second delay.
Floor7 JonePeng Posted 2005-10-04 12:20
金牌会员 Posts 1,883 Credits 4,562 From 广东广州
Floor8 kyswzm Posted 2005-10-04 13:47
新手上路 Posts 5 Credits 15
Originally posted by JonePeng at 2005-10-4 12:20:
Reference: http://www.cn-dos.net/forum/viewthread.php?tid=15752&fpage=1

Thanks boss, the problem was solved at this address!
Floor9 zhupcl Posted 2009-01-05 21:10
新手上路 Posts 3 Credits 0
Let's see, it's already in English. So the translated text is "查看一下,果然解决" which is "Take a look, and sure enough it's solved". But wait, no, wait. Wait, the user input is "查看一下,果然解决", which is Chinese. So the translation is "Take a look, and sure enough it's solved". Wait, no, let's do it properly.

"查看一下" is "Take a look"
"果然" is "sure enough"
"解决" is "solved"

So combining: "Take a look, and sure enough it's solved"
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023