|
怎样优化,我举例一下:
checkrange 0x80 calc *0x401be&0xff && set cpfq=(hd0,0) && goto :_fqdqjc
checkrange 0x80 calc *0x401ce&0xff && set cpfq=(hd0,1) && goto :_fqdqjc
checkrange 0x80 calc *0x401de&0xff && set cpfq=(hd0,2) && goto :_fqdqjc
checkrange 0x80 calc *0x401ee&0xff && set cpfq=(hd0,3) && goto :_fqdqjc
goto :noap
:_fqdqjc
#检查分区是否可以访问
echo
echo The Activate Partition : %cpfq%
cat --length=0 --hex %cpfq%+1 || goto :fqdqcw
goto :_fqgs
==========改成========
set cpfq=
checkrange 0x80 calc *0x401be&0xff && set cpfq=(hd0,0)
checkrange 0x80 calc *0x401ce&0xff && set cpfq=(hd0,1)
checkrange 0x80 calc *0x401de&0xff && set cpfq=(hd0,2)
checkrange 0x80 calc *0x401ee&0xff && set cpfq=(hd0,3)
set cpfq || set err=1 && goto :err
:检查分区是否可以访问
echo
cat --length=0 %cpfq%+1 || set err=2 && goto :err
echo The Activate Partition : %cpfq% may be access!
goto :_fqgs
.....
错误处理用变量代替,统一用err
:err
if %err%==1 ....
if %err%==2 .... |
|