中国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-10-25 22:17
47,815 topics / 349,928 posts / today 0 new / 48,288 members
DOS批处理 & 脚本技术(批处理室) » [Closed]How to use batch processing to modify the parameters of the boot item in Boot.ini
Printable Version  8,408 / 31
Floor31 qzwqzw Posted 2007-01-21 01:45
银牌会员 Posts 636 Credits 2,343
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.
Floor32 lzys Posted 2007-05-18 05:13
初级用户 Posts 28 Credits 54
Learned, all are experts. Hehe
Prev  1 2 3
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023