China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-11 03:36
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » In batch processing, pause for 1 - 2 seconds View 1,735 Replies 8
Original Poster Posted 2005-10-04 11:14 ·  中国 内蒙古 呼和浩特 联通
新手上路
Credits 15
Posts 5
Joined 2005-10-04 11:10
20-year member
UID 43104
Gender Female
Status Offline
@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 ]
Floor 2 Posted 2005-10-04 11:19 ·  中国 山东 济宁 兖州区 联通
钻石会员
★★★★★
Credits 10,056
Posts 3,041
Joined 2002-11-11 00:00
23-year member
UID 223
Gender Male
Status Offline
简单就是美
Floor 3 Posted 2005-10-04 11:22 ·  中国 内蒙古 呼和浩特 联通
新手上路
Credits 15
Posts 5
Joined 2005-10-04 11:10
20-year member
UID 43104
Gender Female
Status Offline
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 ]
Floor 4 Posted 2005-10-04 11:43 ·  中国 安徽 宿州 泗县 电信
银牌会员
★★★
Credits 1,339
Posts 595
Joined 2004-05-26 00:00
22-year member
UID 25306
Gender Male
From 安徽 宿州
Status Offline
Really don't understand what the original poster means
Floor 5 Posted 2005-10-04 12:07 ·  中国 内蒙古 呼和浩特 联通
新手上路
Credits 15
Posts 5
Joined 2005-10-04 11:10
20-year member
UID 43104
Gender Female
Status Offline
It's just that in the instructions, the batch processing delays for 2 seconds!
Floor 6 Posted 2005-10-04 12:11 ·  中国 内蒙古 呼和浩特 联通
新手上路
Credits 15
Posts 5
Joined 2005-10-04 11:10
20-year member
UID 43104
Gender Female
Status Offline
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.
Floor 7 Posted 2005-10-04 12:20 ·  中国 广东 广州 天河区 电信
金牌会员
★★★★
D◎$ Fαп
Credits 4,562
Posts 1,883
Joined 2004-01-19 00:00
22-year member
UID 15812
Gender Male
From 广东广州
Status Offline
----====≡≡≡≡ 我的至爱,永远是MSDOS!≡≡≡≡====----
Floor 8 Posted 2005-10-04 13:47 ·  中国 内蒙古 呼和浩特 联通
新手上路
Credits 15
Posts 5
Joined 2005-10-04 11:10
20-year member
UID 43104
Gender Female
Status Offline
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!
Floor 9 Posted 2009-01-05 21:10 ·  中国 广东 广州 天河区 电信
新手上路
Credits 0
Posts 3
Joined 2008-12-16 12:39
17-year member
UID 134036
Gender Male
Status Offline
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"
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
HAT -4 2009-01-05 21:39
Forum Jump: