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-07-15 00:21
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Closed]How to use batch processing to modify the parameters of the boot item in Boot.ini View 7,463 Replies 31
Floor 31 Posted 2007-01-21 01:45 ·  中国 江西 南昌 电信
银牌会员
★★★
天的白色影子
Credits 2,343
Posts 636
Joined 2004-03-06 00:00
22-year member
UID 19350
Gender Male
Status Offline
Originally posted by lxmxn at 2006-10-28 13:09:


It is not difficult to see that the above batch processing written by brother willsort needs to be run in the root directory of the system disk, and there is no statement to delete the "boot.ini" file in this code. But the following sentence makes me question: "copy %temp%\boot.new boot.ini>nul 2>nul". Here, it will copy "%temp%\boot.new" to the current working directory, that is, to the root directory of the system disk, and change the file name to "boot.ini". At this time, there is already a "boot.ini" file in the root directory of the system disk. At this time, the copy command will ask you whether to rewrite the original "boot.ini" file. However, brother willsort simply adds the " >nul 2>nul" shielding statement at the back. In this way, the system seems to be deadlocked in a questioning state. Of course, the CMD window has no prompts. This obviously does not achieve our purpose, and the result is obviously a copy failure.


This is a matter of experience.

If you have actually tested this code,
you will understand the mystery.

There is a switch /y for copy to control whether to overwrite the file with the same name.
In the command line, this switch is off by default.
In batch processing, this switch is on by default.
So in batch processing, copy does not need the /y switch.
Unless there is an environment variable copycmd and /-y value is specified.
Floor 32 Posted 2007-05-18 05:13 ·  中国 河北 石家庄 桥西区 联通
初级用户
Credits 54
Posts 28
Joined 2006-10-16 14:23
19-year member
UID 65980
Gender Male
Status Offline
Learned, all are experts. Hehe
Forum Jump: