|
kyswzm
新手上路

积分 15
发帖 5
注册 2005-10-4
状态 离线
|
『楼 主』:
(搜索主题{15752})在批处理中暂停1-2秒
使用 LLM 解释/回答一下
@echo off
rem 在这里等上1-2秒(不是等待按键啊),或者,在这里加一个无聊的长循环也可以啊
del nwpt2005.Exe
ren xnwpt2005.exe nwpt2005.Exe
Start nwpt2005.Exe
del shengji.bat
操作系统是XP,拜托!拜托!
---------- Edited by willsort ----------
修改原标题:新手,批处理的一个语句求助!
---------- Edited by willsort ----------
Last edited by willsort on 2005-10-4 at 22:00 ]
@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 ]
|
|
2005-10-4 11:14 |
|
|
Michael
钻石会员
       
积分 10046
发帖 3039
注册 2002-11-11
状态 离线
|
|
2005-10-4 11:19 |
|
|
kyswzm
新手上路

积分 15
发帖 5
注册 2005-10-4
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
感谢大虾,具体给说说吧!
CHOICE /T 2 好像不行啊,是XP操作系统不支持这个命令,还是......
Last edited by kyswzm on 2005-10-4 at 11:30 ]
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 ]
|
|
2005-10-4 11:22 |
|
|
chujiafu
银牌会员
    
积分 1339
发帖 595
注册 2004-5-26 来自 安徽 宿州
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
真搞不懂楼主是什么意思
Really don't understand what the original poster means
|
|
2005-10-4 11:43 |
|
|
kyswzm
新手上路

积分 15
发帖 5
注册 2005-10-4
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
就是在说明那里批处理延迟2秒啊!
It's just that in the instructions, the batch processing delays for 2 seconds!
|
|
2005-10-4 12:07 |
|
|
kyswzm
新手上路

积分 15
发帖 5
注册 2005-10-4
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
做的软件想有自动升级功能,用BAT文件方式。但在批处理里,需要暂停数秒,使启动BAT文件的程序有足够的时间关闭(BAT里要删除这个启动文件),万事具备,就是不会写这个DOS的暂停数秒的语句----不是等待按键啊(这样也可以)。大虾帮忙,我在网上找了很久了啊!
升级程序已经下载了,比如原程序是A.exe,我下载了新程序B.EXE,现在,要用BAT(批处理)文件来删除A.EXE,再重命名B.EXE----A.EXE就OK了。但那个BAT文件是A.EXE启动的,在它没有完全关闭之前,BAT删除不了它,要等上1-2秒!
bat 程序
@echo off
pause 现在是暂停,等待输入任意键后继续,不能完全自动啊
rem 在这里等上1-2秒,或者,在这里加一个无聊的长循环也可以啊
del nwpt2005.Exe
ren xnwpt2005.exe nwpt2005.Exe
Start nwpt2005.Exe
del shengji.bat
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.
|
|
2005-10-4 12:11 |
|
|
JonePeng
金牌会员
      D◎$ Fαп
积分 4562
发帖 1883
注册 2004-1-19 来自 广东广州
状态 离线
|
|
2005-10-4 12:20 |
|
|
kyswzm
新手上路

积分 15
发帖 5
注册 2005-10-4
状态 离线
|
|
2005-10-4 13:47 |
|
|
zhupcl
新手上路

积分 0
发帖 3
注册 2008-12-16
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
查看一下,果然解决
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"
此帖被 -4 点积分 点击查看详情 评分人:【 HAT 】 | 分数: -4 | 时间:2009-1-5 21:39 |
|
|
|
2009-1-5 21:10 |
|