中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟
中国DOS联盟论坛
现在时间是 2026-08-18 04:25
47,814 主题排行 / 349,907 发帖 / 今日 4 篇 / 48,259 会员排行
DOS批处理 & 脚本技术(批处理室) » 在批处理中,如何显示倒计时?
可打印版本  6,520 / 33
第16楼 kcdsw 发表于 2006-04-10 20:48
中级用户 发帖 179 积分 404
呵呵 楼上说的是先前执行的结果吧? 如果要显示固定内容 多加个echo就成了
第17楼 martin325 发表于 2006-04-10 21:27
银牌会员 发帖 603 积分 1,582
这个不成的,如果循环执行的话,每次都显示一遍,累啊,也会占用很多内存的吧!

倒计时30秒,那不是要显示30遍,呵呵……
第18楼 martin325 发表于 2006-04-11 08:42
银牌会员 发帖 603 积分 1,582
能否把Clock修改到体积只在4K之内?
Clock 2.12
DOS下最好的TSR方式的时钟工具。它的功能相当多也非常强大,比如可以以多种格式(如12/24小时制,是否显示分/秒/毫秒等)显示,指定时钟在屏幕上的显示位置(默认在屏幕的右上角),还可随时在命令行上启用/禁用/退出等。

请高手修改Clock 2.12,使其体积只在4K之内,功能只要倒计时(或顺计时),并在屏幕任意指定的位置显示。

先谢谢了:)

附件
CLOCK.rar (5.42 KiB)
第19楼 Climbing 发表于 2006-04-11 09:37
铂金会员 发帖 2,753 积分 6,962 来自 河北保定
似乎Horst的wait4程序更好用。

------------------------------------------------------------------------
WAIT4 Batch: Wait for ..... Ver 1.4 (c) 1996 Horst Schaeffer
------------------------------------------------------------------------

Syntax: WAIT4 hh:mm:ss

WAIT4 waits according to given time and displays a "digital clock" as
a pop-up window - the ground is restored after the time has elapsed.
Abort by any key (optional: ESC only).

Time display/specification always in 24 hour mode (no am/pm).

Time specification:

(1) Target time in the form hh:mm:ss, where seconds and minutes
are optional, examples:

WAIT4 12:15 means: WAIT4 12:15:00
WAIT4 20 means: WAIT4 20:00:00

(2) Period of time with preceeding "+". Here the seconds are
mandatory, and minutes/hours may be omitted.

WAIT4 +12:15 means: WAIT4 + 00:12:15
WAIT4 +20 means: WAIT4 + 00:00:20

(3) no specification: Clock runs until stopped by keystroke

For (1) and (2) the target time is shown under the clock.

Options:

/O Over midnight:
If the given time has passed already, the program is terminated
instantly (errorlevel 250, see below), unless you have specified
by option /O, that the given time is meant for the next day.

If you specify a period of time, option /O is not necessary.

Option /O is ignored, if the given time has not yet been reached
on the same day, because WAIT4 will wait a maximum of 24 hours.

/D CountDown display instead of current time.

/E ESC: abort with ESC only, other keys ignored.

/B Bell after time elapsed.

/Pl,c Position:
The position of the clock may be given by line and column,
both counting from 1. Specifications will be corrected if the
display window would not fit on the screen (current display
mode checked). Default line=current, column=32.

/Rn Random position on screen, changes every n seconds

/S Screen to clear at start (not restored at end)

/Cn Color:
Color code n can be obtained by addition of following color
values (default: 79 = bright white on red):

character: background:
0 0 black
1 16 blue
2 32 green
3 48 cyan
4 64 red
5 80 magenta
6 96 brown/yellow
7 112 white
+8 bright

Example: bright green on magenta
= 8 + 2 + 80 = 90

Errorlevel:

0 Time elapsed
1-199 aborted by ASCII key with code 1..199
200 aborted by any other key
250 target time passed already at start of program
255 invalid command arguments


Digit fonts to patch:

The file WAIT4.PAT is a DEBUG script to patch the digit fonts.
Use an editor to copy the section with the desired font into the
script (or make your own digits). Then, on the command line, enter:

DEBUG WAIT4.COM < WAIT4.PAT


Note: Time slices are released under WINDOWS, OS/2 and DV.

----
WAIT4 is freeware by Horst Schaeffer - no warranties of any kind
eMail: horst.schaeffer@gmx.net

= 04 AUG 2002
第20楼 martin325 发表于 2006-04-11 09:42
银牌会员 发帖 603 积分 1,582
哪儿有下载wait4 ?
第21楼 martin325 发表于 2006-04-11 16:03
银牌会员 发帖 603 积分 1,582
找到Horst的主页,可是没发现有wait4程序啊!

http://home.mnet-online.de/horst.muc/index.html
第22楼 martin325 发表于 2006-04-12 22:15
银牌会员 发帖 603 积分 1,582
请Climbing
上传WAIT4
第23楼 martin325 发表于 2006-04-13 20:09
银牌会员 发帖 603 积分 1,582
还是自力更生,呵呵,写了一封简短的信给作者。
作者给我回信如下:
Hello,

Wait4 is available on my website in the
PBats package.
See Menu on the left, "Horst's PBats"

终于找到了,呵呵,现在上传,给大家共享。

附件
pbats32.zip (59.58 KiB)
第24楼 Climbing 发表于 2006-04-14 09:30
铂金会员 发帖 2,753 积分 6,962 来自 河北保定
是你自己没有好好找,人家的网站上说得很清楚的。
第25楼 martin325 发表于 2006-04-14 10:10
银牌会员 发帖 603 积分 1,582
不是没好好找,而是人家的网站上不是总是提供下载的!
刚刚我还特意去看了看,那个下载说明和联结又没有了!
不信的话,你现在就去看看:http://home.mnet-online.de/horst.muc/index.html
点击左边菜单的Horst's Pbats,总是显示原来的网页,也没有WAIT4的说明!
第26楼 qzwqzw 发表于 2006-04-14 11:34
银牌会员 发帖 636 积分 2,343
有啊,就在左边导航栏里,有pbat的链接,不过好像是框架结构的网页,所以直接输入网页链接不太管用。不过pbat的下载链接可以获得:
http://home.mnet-online.de/horst.muc/int/pbats32.zip
第27楼 willsort 发表于 2006-04-14 18:27
元老会员 发帖 1,512 积分 4,432
Originally posted by martin325 at 2006-4-10 21:27:
这个不成的,如果循环执行的话,每次都显示一遍,累啊,也会占用很多内存的吧!

倒计时30秒,那不是要显示30遍,呵呵……


Re martin325:

30秒的倒计时确实可能会显示30遍屏幕信息,但是这并不会显著影响批处理代码的运行效率。对于echo之类的输入输出命令,系统特别是BIOS层有自己独特的处理方式,以保证其高效性。因此在系统资源和时间的耗费上,将一屏信息显示30遍并不能简单地叠加为显示1遍的30倍。

实际测试中,cls后再echo并不会给倒计时带来可以察觉的误差,而由于cls所可能带来的刷屏闪烁问题,也只有程序处在软盘等访问速度较低的介质上时才会出现。

当然,这并非鼓励你使用pure batch进行代码编写,在条件允许的前提下使用第三方工具,确实可以方便的解决许多问题,并同时减少代码的编写量和复杂度。但是,如果你是为群体用户编写代码,那么就必须考虑是否可以付出第三方工具所需要的代价,比如兼容性、安全性、版权问题等等。
第28楼 appleliuyg 发表于 2006-04-17 14:15
新手上路 发帖 2 积分 4
60秒倒计时显示
for /l %a in (60,-1,1) do echo %a&&choice /t 1 /d y /n

以测过。
第29楼 martin325 发表于 2006-04-17 20:13
银牌会员 发帖 603 积分 1,582
呵呵,在DOS下测试,没通过!
第30楼 awtq 发表于 2007-05-09 11:01
新手上路 发帖 1 积分 2
60秒倒计时執行命令要怎樣做??
上一页  1 2 3  下一页
[ 联系联盟系统管理团队 - 中国DOS联盟 - 标准版 ]
Sponsored by ifanr Inc | © 2001–2023