|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 16 楼』:
使用 LLM 解释/回答一下
Originally posted by willsort at 2006-6-11 16:54:
:: ModBoot.cmd - V3 - Modify of boot.ini
:: Will Sort - 2006-6-11 - CMD@WinXP
@echo off
if not exist boot.ini echo Not found boot.ini!&goto :eof
if exist %temp%\boot.new del /f /a %temp%\boot.new
find/i "/kernel=" boot.ini>nul && echo Modified boot.ini! && goto :eof
for /f "delims=" %%l in (boot.ini) do (
echo.%%l | find/i "/fastdetect" >nul && echo %%l /kernel=kernel.exe || echo %%l
)>>%temp%\boot.new
find/i "/kernel" %temp%\boot.new>nul 2>nul
if errorlevel 1 echo Fail to parse boot.ini!&goto :eof
attrib -s -h -r boot.ini
copy boot.ini %temp%\boot.bak>nul&&echo Pass to backup boot.ini.
copy %temp%\boot.new boot.ini>nul 2>nul
find/i "/kernel" boot.ini>nul 2>nul
if not errorlevel 1 echo Pass to wrtie boot.ini.
if errorlevel 1 copy %temp%\boot.bak boot.ini>nul & echo Fail to wrtie boot.ini!
attrib +s +h +r boot.ini
del %temp%\boot.new & del %temp%\boot.bak
看了一下willsort兄写的代码,写得的确不错,但是对里面的某一个语句难免会感到质疑,特别是"copy %temp%\boot.new boot.ini>nul 2>nul"这一句。
不难看出,以上willsort兄写的批处理要在系统盘根目录中运行,而这段代码中并没有删除"boot.ini"文件的语句,但是后面的这句让我感到质疑:"copy %temp%\boot.new boot.ini>nul 2>nul",这里会把"%temp%\boot.new" copy 到当前的工作目录中来,也就是 copy 到系统盘的根目录中来,并且将文件名改为"boot.ini",而此时系统盘的根目录里面已经有了一个"boot.ini"文件,这时 copy 命令就要询问你是否改写原来的"boot.ini"文件,而willsort兄只是简单的在后面加上">nul 2>nul"这个屏蔽的语句,这样一来,系统就好象死锁在一种询问的状态,当然CMD窗口并没有任何的提示。这显然没有达到我们的目的,结果显然是 copy 失败了。
以上只是我对willsort兄所写的批处理里面的一条语句的一点小小的质疑,如果小弟有什么地方弄错了,还请大伙及willsort兄见谅。
Last edited by lxmxn on 2006-10-29 at 02:13 AM ]
Originally posted by willsort at 2006-6-11 16:54:
:: ModBoot.cmd - V3 - Modify of boot.ini
:: Will Sort - 2006-6-11 - CMD@WinXP
@echo off
if not exist boot.ini echo Not found boot.ini!&goto :eof
if exist %temp%\boot.new del /f /a %temp%\boot.new
find/i "/kernel=" boot.ini>nul && echo Modified boot.ini! && goto :eof
for /f "delims=" %%l in (boot.ini) do (
echo.%%l | find/i "/fastdetect" >nul && echo %%l /kernel=kernel.exe || echo %%l
)>>%temp%\boot.new
find/i "/kernel" %temp%\boot.new>nul 2>nul
if errorlevel 1 echo Fail to parse boot.ini!&goto :eof
attrib -s -h -r boot.ini
copy boot.ini %temp%\boot.bak>nul&&echo Pass to backup boot.ini.
copy %temp%\boot.new boot.ini>nul 2>nul
find/i "/kernel" boot.ini>nul 2>nul
if not errorlevel 1 echo Pass to wrtie boot.ini.
if errorlevel 1 copy %temp%\boot.bak boot.ini>nul & echo Fail to wrtie boot.ini!
attrib +s +h +r boot.ini
del %temp%\boot.new & del %temp%\boot.bak
I took a look at the code written by Brother willsort, and it's really good, but I can't help but have some doubts about a certain statement in it, especially the sentence "copy %temp%\boot.new boot.ini>nul 2>nul".
It's not hard to see that the above batch processing written by Brother willsort should be run in the root directory of the system drive, and there is no statement to delete the "boot.ini" file in this code, but this sentence later makes me doubtful: "copy %temp%\boot.new boot.ini>nul 2>nul", here it will copy "%temp%\boot.new" to the current working directory, that is, copy to the root directory of the system drive, and change the file name to "boot.ini", and at this time there is already a "boot.ini" file in the root directory of the system drive, then the copy command will ask you whether to rewrite the original "boot.ini" file, and Brother willsort just simply adds the " >nul 2>nul" shielding statement at the back, in this way, the system seems to be deadlocked in a state of asking, of course, the CMD window has no prompts at all. This obviously doesn't achieve our purpose, and the result is obviously a copy failure.
The above is just a small doubt I have about a statement in the batch processing written by Brother willsort. If I made any mistakes, please forgive me from everyone and Brother willsort.
Last edited by lxmxn on 2006-10-29 at 02:13 AM ]
|
|
2006-10-29 02:09 |
|
|
0451lym
高级用户
   
积分 760
发帖 357
注册 2005-10-10
状态 离线
|
『第 17 楼』:
使用 LLM 解释/回答一下
Originally posted by maotao at 2006-6-10 21:15:
我也翻阅了 Bootcfg 的帮助,确实没有添加自定义开关的选项。
XP 下最简单的方式:
bootcfg /raw "/Kernel=Kernel.exe " /id 1
bootcfg /raw:以字符串形式在 Boot.ini 文件的 区段中向操作系统项添加指定的操作系统加载项。
/id 1: 指定在 Boot.ini 文件的 区段内要更新的操作系统项的行号。 标题区域后的首行是 1。
"/Kernel=Kernel.exe ":??????
呵呵!
Last edited by 0451lym on 2006-10-31 at 10:56 AM ]
Originally posted by maotao at 2006-6-10 21:15:
I also flipped through the help of Bootcfg, and indeed there is no option to add custom switches.
The simplest way under XP:
bootcfg /raw "/Kernel=Kernel.exe " /id 1
bootcfg /raw: Adds the specified operating system load item to the operating system item in the section of the Boot.ini file in the form of a string.
/id 1: Specifies the line number of the operating system item to be updated in the section of the Boot.ini file. The first line after the title area is 1.
"/Kernel=Kernel.exe ": ????
Hehe!
Last edited by 0451lym on 2006-10-31 at 10:56 AM ]
|
|
2006-10-31 10:44 |
|
|
chen004
新手上路

积分 2
发帖 1
注册 2006-2-9
状态 离线
|
『第 18 楼』:
高手
使用 LLM 解释/回答一下
我可看不懂??????????
I can't understand it??????
|
|
2006-10-31 21:25 |
|
|
maotao
初级用户
 
积分 44
发帖 14
注册 2006-6-7
状态 离线
|
『第 19 楼』:
使用 LLM 解释/回答一下
Originally posted by 0451lym at 2006-10-31 10:44:
XP 下最简单的方式:
bootcfg /raw "/Kernel=Kernel.exe " /id 1
bootcfg /raw:以字符串形式在 Boot.ini 文件的 区段中向操作系统顠...
这样似乎不行吧,你再到 Boot.ini 中看看,该系统菜单项原来的一些开关项是不是没了?
Originally posted by 0451lym at 2006-10-31 10:44:
The simplest way under XP:
bootcfg /raw "/Kernel=Kernel.exe " /id 1
bootcfg /raw: In the section of the Boot.ini file, add to the operating system as a string...
This doesn't seem to work. You go to Boot.ini and check if some original switch items of that system menu entry are missing?
|
|
2006-11-1 08:38 |
|
|
0451lym
高级用户
   
积分 760
发帖 357
注册 2005-10-10
状态 离线
|
『第 20 楼』:
使用 LLM 解释/回答一下
Originally posted by maotao at 2006-11-1 08:38:
这样似乎不行吧,你再到 Boot.ini 中看看,该系统菜单项原来的一些开关项是不是没了?
Microsoft Windows XP
(C) 版权所有 1985-2001 Microsoft Corp.
D:\Documents and Settings\Administrator>bootcfg /raw "/Kernel=Kernel.exe " /id1
成功: 在 Boot.ini 文件中的操作系统项目"1"上添加了开关。
D:\Documents and Settings\Administrator>c
我的BOOT.INI更改为:
timeout=5
default=multi(0)disk(0)rdisk(0)partition(2)\WINDOWS
multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="☆我的办公系统☆" /kernel=kernel.exe
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="★我的备用系统★" /noexecute=optin /fastdetect
C:\grldr="
Originally posted by maotao at 2006-11-1 08:38:
This doesn't seem to work. Please check again in Boot.ini to see if some original switch items of that system menu entry are missing?
Microsoft Windows XP
(C) Copyright 1985-2001 Microsoft Corp.
D:\Documents and Settings\Administrator>bootcfg /raw "/Kernel=Kernel.exe " /id1
Success: The switch was added to the operating system entry "1" in the Boot.ini file.
D:\Documents and Settings\Administrator>c
My BOOT.INI is changed to:
timeout=5
default=multi(0)disk(0)rdisk(0)partition(2)\WINDOWS
multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="☆My Office System☆" /kernel=kernel.exe
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="★My Backup System★" /noexecute=optin /fastdetect
C:\grldr="
|
|
2006-11-1 20:10 |
|
|
0451lym
高级用户
   
积分 760
发帖 357
注册 2005-10-10
状态 离线
|
『第 21 楼』:
使用 LLM 解释/回答一下
刚看明白你的意思,你这样弄:
bootcfg /raw "/noexecute=optin /fastdetect/Kernel=Kernel.exe " /id 1
“”中的开关多少都可以,把想要得加全了就可以了!
D:\Documents and Settings\Administrator>bootcfg /raw "/noexecute=optin /fastdet
ect/Kernel=Kernel.exe " /id 1
成功: 在 Boot.ini 文件中的操作系统项目"1"上添加了开关。
D:\Documents and Settings\Administrator>
我的BOOT.INI更改为:
[boot loader]
timeout=5
default=multi(0)disk(0)rdisk(0)partition(2)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="☆我的办公系统☆" /noexecute=optin /fastdetect/kernel=kernel.exe
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="★我的备用系统★" /noexecute=optin /fastdetect
C:\grldr="[1;32m我的镜像恢复系统 [1;34m→ [1;31m06金秋版!"
Just now I understood what you meant. You do it like this:
bootcfg /raw "/noexecute=optin /fastdetect/Kernel=Kernel.exe " /id 1
You can have any number of switches in the ""; just add all the ones you want!
D:\Documents and Settings\Administrator>bootcfg /raw "/noexecute=optin /fastdetect/Kernel=Kernel.exe " /id 1
Success: The switch was added to the operating system entry "1" in the Boot.ini file.
D:\Documents and Settings\Administrator>
My BOOT.INI has been changed to:
timeout=5
default=multi(0)disk(0)rdisk(0)partition(2)\WINDOWS
multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="☆My Office System☆" /noexecute=optin /fastdetect/kernel=kernel.exe
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="★My Backup System★" /noexecute=optin /fastdetect
C:\grldr="
|
|
2006-11-1 20:25 |
|
|
maotao
初级用户
 
积分 44
发帖 14
注册 2006-6-7
状态 离线
|
『第 22 楼』:
使用 LLM 解释/回答一下
Originally posted by 0451lym at 2006-11-1 20:25:
刚看明白你的意思,你这样弄:
bootcfg /raw "/noexecute=optin /fastdetect/Kernel=Kernel.exe " /id 1
“”中的开关多少都可以,把想要得加全了就可以了..
这样是没有问题了,不过还得先了解原先的一些开关才可以这样的,假如原来的参数不是这样,。。。
Originally posted by 0451lym at 2006-11-1 20:25:
Just understood what you mean. Do it like this:
bootcfg /raw "/noexecute=optin /fastdetect/Kernel=Kernel.exe " /id 1
You can have any number of switches in the quotes. Just add all the ones you want...
It's okay like this, but you still need to understand some of the original switches first. If the original parameters were not like this,...
|
|
2006-11-1 21:03 |
|
|
0451lym
高级用户
   
积分 760
发帖 357
注册 2005-10-10
状态 离线
|
『第 23 楼』:
使用 LLM 解释/回答一下
Originally posted by maotao at 2006-11-1 21:03:
这样是没有问题了,不过还得先了解原先的一些开关才可以这样的,假如原来的参数不是这样,。。。
XP默认的开关就是那几个,没必要把许多垃圾开关都加上吧?
问题简单的好,不要复杂!
Originally posted by maotao at 2006-11-1 21:03:
This is no problem, but you still need to understand some original switches first. If the original parameters were not like this,...
The default switches in XP are just a few. There's no need to add many useless switches, right?
The problem should be simple, not complicated!
|
|
2006-11-1 23:12 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 24 楼』:
使用 LLM 解释/回答一下
maotao 是想把系统盘改造成个性化的,XP的默认设置并不能满足个性化需求——高手一般都喜欢DIY的,也没有几个高手在使用MS的原版安装光盘。
maotao wants to transform the system disk into a personalized one. The default settings of XP cannot meet the personalized needs - experts generally like DIY, and there are not many experts using MS's original installation discs.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-11-1 23:31 |
|
|
newaifi
初级用户
 
积分 154
发帖 67
注册 2006-10-31
状态 离线
|
『第 25 楼』:
使用 LLM 解释/回答一下
收益非浅.. 本人在此也不再赘述了..
Got a lot out of it.. I won't go into details here anymore..
|
|
2006-11-2 01:54 |
|
|
voiL
中级用户
  
积分 384
发帖 189
注册 2005-10-19
状态 离线
|
『第 26 楼』:
使用 LLM 解释/回答一下
这个对偶也有用,先收了,再轻轻地顶一下.
This pair is also useful, first save it, then gently give it a top.
|
|
2006-11-5 02:32 |
|
|
jasonwang
初级用户
 
积分 122
发帖 54
注册 2006-11-3
状态 离线
|
『第 27 楼』:
使用 LLM 解释/回答一下
17楼说的对,不过如何判断是ID1?似乎加上一些批处理似乎为好。
What the person on floor 17 said is correct, but how to judge it's ID1? It seems that adding some batch processing is better.
|
|
2006-11-9 02:52 |
|
|
different
初级用户
 
积分 48
发帖 20
注册 2005-10-14
状态 离线
|
『第 28 楼』:
将楼主的问题逆向,如何做?
使用 LLM 解释/回答一下
我现在想使用批处理找到里面的
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /execute /fastdetect /Kernel=Kernel.exe
这一行,并且能够在这行的末尾减少字符串,比如修改成
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /execute /fastdetect
也想只用XP系统自带的功能,不用外部工具。
I'm now going to use batch processing to find the line:
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /execute /fastdetect /Kernel=Kernel.exe
And be able to reduce the string at the end of this line, for example, modify it to:
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /execute /fastdetect
Also, I want to use only the functions built into XP system, without using external tools.
|
|
2007-1-15 16:43 |
|
|
wanyu555
初级用户
 
积分 22
发帖 9
注册 2007-1-16
状态 离线
|
『第 29 楼』:
使用 LLM 解释/回答一下
各位大大实在是太帅了
Great lords are really too handsome
|
|
2007-1-17 12:47 |
|
|
gocndos
新手上路

积分 8
发帖 4
注册 2007-1-15
状态 离线
|
|
2007-1-21 01:23 |
|