|  | 
6#
 
 
 楼主|
发表于 2011-5-6 09:21:48
|
只看该作者 
| !BAT if not exist debug set debug=off
 debug %debug%
 pager off
 #判断相关文件是否已载到软驱
 if exist (fd0)/mbr52 goto start
 map --mem /BOOTLDR.IMG (fd0) || find --set-root /BOOTLDR.IMG && map --mem /BOOTLDR.IMG (fd0)
 map --hook
 
 
 
 
 #微软的工具 使用了严格的参数顺序检查,不能改变顺序,为了方便编程,决定采取相同的处理方法。
 #微软的工具 第一个参数指定要更新的引导代码类型,第二个参数指定要更新的对象
 #微软的工具 第二个参数必须是磁盘的盘符或者是启动分区,不能忽略掉
 #微软的工具 不能忽略掉第二个参数,仅执行主引导的刷新操作,本工具决定做一下改动
 
 # 本工具初步构想如下:
 # 第一个参数用于指定引导代码,或者是指定清除扇区的操作
 # 第一个参数为 clear 时 ,第二个参数必须指定硬盘 如 hd0  hd1 如果第二个参数为空 默认为hd0
 # 第二个参数设定要进行操作的对象,可以是活动分区,指定分区,或者是MBR
 # 第三个参数根据第二个参数来决定取值,如果第二个参数设定要对MBR进行操作则第三个参数必须指定硬盘
 # 如果第二个参数指定为分区操作,则第三个参数/mbr为可选,即可以同时进行DBR跟MBR的操作
 # 分区与磁盘的表示法: 采用GRUB4DOS的表示法,同样是为了简化编程
 
 :start
 if #%1==# goto help
 if /i #%1==#clear goto cl162
 
 :help
 echo bootsect {/nt52|/nt60|clear} {sys|partition|/mbr} {disk|/mbr}
 echo bootsect {/nt52|/nt60} /mbr {disk}
 echo bootsect clear {disk}
 echo bootsect {/nt52|/nt60} {sys|partition} [/mbr]
 echo bootsect /nt52 (hd0,0)
 echo bootsect /nt52 (hd0,0) /mbr
 echo bootsect /clear (hd0)
 echo bootsect /nt52 /mbr (hd0)
 goto end
 
 :cl162
 if #%2==# set disk=(hd0) && goto qcks
 debug on
 set disk=%2 && set /a leng=*0x4cb00
 if not #%leng%==#5 goto cs2cu
 set csqz=%disk:~0,3%
 if /i not #%csqz%==#(hd goto cs2cu
 set csqz=%disk:~4,1%
 if /i not #%csqz%==#) goto cs2cu
 
 #参数二取值判断
 cat --length=0 --hex %disk%+1 || goto cs2cu
 :qcks
 clear
 echo Warning! %disk% 1-62 Sectors Will be Clear!
 call sfjx
 echo -n > %disk%1+62 && goto zxcg
 goto zxsb
 
 
 :sfjx
 set /p JX=Do you want to continue? (y/n)
 if /i not #%JX%==#y  goto end
 
 
 
 
 
 
 
 
 :cs2cu
 echo The disk value: %disk% is error!
 echo The disk value: (hd0) (hd1)
 echo bootsect clear (hd0)
 goto end
 
 :zxsb
 echo Operation failed!
 goto end
 :zxcg
 echo Operation completed successfully!
 
 :end
 pause Please Enter to Exit.
 exit
 
 暂时只写了上面的部分,但是发现有个错误,一直不知道是哪儿的原因。
 | 
 |