中国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-09-23 16:04
47,812 topics / 349,917 posts / today 0 new / 48,273 members
DOS批处理 & 脚本技术(批处理室) » Please provide the batch code that needs to be simplified so that I can help you with the simplification.
Printable Version  2,419 / 5
Floor1 gmy Posted 2006-01-10 11:29
版主 Posts 392 Credits 1,113
@echo off
for %%d in (c d e f g h i j k l m n o p q r s t u v w) do (
if exist %%d:\boot.ini (
set drv=%%d:
copy %%d:\boot.ini %%d:\boot.bak
goto end
)
)
:end
Floor2 willsort Posted 2006-01-10 15:10
元老会员 Posts 1,512 Credits 4,432
Re gmy:

The key improvement of your program is not in simplifying the statements, but in fault tolerance processing, because when going from C: to W:, it is very likely to encounter optical drives with no discs placed, network drives not connected to the network, and some special USB storage devices, etc. Using if exist to detect the existence of boot.iini here will encounter many unexpected problems.

The appearance of the third-party command dready has solved many problems. There have been many programs using it to loop through detecting drive sequences in this forum. You can search more for past posts . But it cannot solve all problems. For specific discussions, see .

Drive Polling Traversal Program Index
9637-12-walu-Drive Polling Traversal-1
http://www.cn-dos.net/forum/viewthread.php?tid=9637

11963-9-walu-Drive Polling Traversal-2
http://www.cn-dos.net/forum/viewthread.php?tid=11963

14620-9-ramjet-Drive Polling Traversal-3
http://www.cn-dos.net/forum/viewthread.php?tid=14620

14667-9-lin8197-Drive Polling Traversal-4
http://www.cn-dos.net/forum/viewthread.php?tid=14667

15599-9-GOTOmsdos-Drive Polling Traversal-5 (Link Bat)
http://www.cn-dos.net/forum/viewthread.php?tid=15599

Some Technical Discussions on HDKP
http://www.cn-dos.net/forum/viewthread.php?tid=12892#pid95281
Floor3 bush Posted 2006-01-11 00:06
银牌会员 Posts 730 Credits 2,165
Wil is really a person with a heart!
Floor4 gmy Posted 2006-01-11 12:30
版主 Posts 392 Credits 1,113
re: willsort

Thank you. It has been solved.



[ Last edited by gmy on 2006-1-11 at 13:40 ]
Floor5 willsort Posted 2006-01-11 14:43
元老会员 Posts 1,512 Credits 4,432
Re gmy:

From the way your current program operates, it will always detect all drives from C to W, rather than immediately exiting as soon as a matching drive letter is detected, to avoid issues with unallocated drive letters and possible access to other drives. This is my modified version. Of course, it still can't fundamentally solve the drive letter access problem, just reduces the probability of problems occurring.

Floor6 maya0su Posted 2006-01-15 00:56
中级用户 Posts 131 Credits 241
Good post! The boot disk of the original poster I'm using right now, willsort's research on batch processing is really admirable!
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023