[Ubuntu-zh] 回复: win7下硬盘安装ubuntu居然没成功

Peter Derek 1and1get2在gmail.com
星期六 七月 9 07:00:30 UTC 2011


CODE:======================
--===  windows 7  ===--
--===    grub     ===--
@echo off
cd /d %~dp0
del temp_bcd.txt >nul 2>nul
COLOR f9
set timeout=5
set gname=GRUB 4 DOS
set mbrname=grldr.mbr
set pingtime=5
rem
pingtime是程序操作完成后的自动退出等待时间,调节与否随意,gname是bcd启动菜单显示名称,根据喜好可自己设置,mbrname是mbr的名称,可以自己改名,timeout是bcd菜单等待选择时间,自己随便调
set vid=
set destpart=
Set TIT=在bootmgr系统启动项中安装与卸载(grub4dos)项目的批处理
TITLE %TIT%
echo.
echo 检测权限...
bcdedit >temp_bcd.txt 2>nul
type temp_bcd.txt | find "Windows Boot Manager" >nul && goto gaosir
del temp_bcd.txt >nul 2>nul
echo 请在VISTA/WIN7/2008系统中以管理员身份运行,任意键退出.
pause>nul
exit
:gaosir
echo 权限检测已通过
set inputv=
echo.
echo 请输入你要安装的文件全名,若不输入直接回车采用默认值%mbrname%
echo 以下是扩展名为.mbr的文件列表,仅供参考
dir /a /b *.mbr
echo.
echo.
set /p inputv=输入安装的文件名,直接回车采用%mbrname%,可用TAB键选择或快速补齐:
if not "%inputv%"=="" set mbrname=%inputv%
echo.
echo.
if not exist %mbrname% echo
请注意,当前目录下没有%mbrname%文件,但仍可以继续安装,安装完成时会提示您将%mbrname%文件手动复制到您即将选择的安装盘中&pause
set gname2=\%mbrname%
type temp_bcd.txt | find "%gname2%" >nul && goto un_bcd
set defdest=%systemdrive%
for %%i in (c d e f g h i j k l m n o p q r s t u v w x y z) do if exist
%%i:\boot\bcd set defdest=%%i:&goto seldest
:seldest
set destpart=%defdest%
COLOR f9
set inputv=
echo.
echo 请输入%mbrname%文件的安装盘符,直接回车采用%destpart%盘根目录
echo 输入盘符时不用输入冒号,如D盘输入D或d即可
echo.
set /p inputv=输入盘符(不带冒号),直接回车默认%destpart%盘:
if not "%inputv%"=="" set destpart=%inputv%:
if not exist "%destpart%\" goto patherr
md %destpart%\v7ts6qk9
if not exist "%destpart%\v7ts6qk9" goto writerr
rd "%destpart%\v7ts6qk9"
goto bcd_1
:patherr
color 0c
cls
echo 指定盘符%destpart%无效, 按任意键重新指定!!!
pause
goto seldest
:writerr
color 0c
cls
echo.
echo 指定盘不可写入, 可能为光驱, 请重新指定 !!!
pause
goto seldest
:bcd_1
bcdedit  /create /d "%gname%" /application bootsector >vid.ini
for,/f,"tokens=2 delims={",%%i,In (vid.ini) Do set vida=%%i
for,/f,"tokens=1 delims=}",%%i,In ("%vida%") Do set vid={%%i}
bcdedit  /set %vid% device partition=%destpart%  >nul
bcdedit  /set %vid% path %gname2% >nul
bcdedit  /displayorder %vid% /addlast >nul
bcdedit  /timeout  %timeout% >nul
echo   BCD菜单项"%gname%"添加完成
if exist %mbrname% (
attrib %destpart%\%mbrname% -h -s -r >nul 2>nul
copy %mbrname% %destpart%\ /y
attrib %destpart%\%mbrname% +h +s +r
goto exit
) else (
echo   稍后请自行把%mbrname%拷贝到%destpart%\根目录
echo.
set /a pingtime=%pingtime%+8
Goto exit
)
:un_bcd
echo.
echo   Vista的BCD启动项中存在项目["%gname2%"]。
echo   ==============================================
echo.
set un_bcd=
Set /P un_bcd=  是否需要卸载%gname2%项目 ?[y/是  n/否]:
If /i %un_bcd%#==y# goto un_bcd_1
If /i %un_bcd%#==n# echo 卸载已取消...&goto exit
cls
echo.
echo 选择错误,请输入Y或者N(不分大小写)后继续
Goto un_bcd
:un_bcd_1
for /f "tokens=1 delims=:" %%i In ('findstr /n %gname2%  temp_bcd.txt') Do (
                 Set nid=%%i
)
set /a nid=%nid%-3
for /f "skip=%nid% tokens=2" %%i in (temp_bcd.txt) do set vid=%%i&goto vidok
:vidok
bcdedit /delete %vid% /cleanup >nul
bcdedit /timeout   %timeout% >nul
bcdedit >temp_bcd.txt
type temp_bcd.txt | find "%gname2%" >nul && goto un_bcd
echo 已成功卸载%gname2%项目
if exist %destpart%\%mbrname% (
      attrib -h -s -r %destpart%\%mbrname% >nul
      del %destpart%\%mbrname% >nul
)
:exit
del temp_bcd.txt >nul 2>nul
del temp_bcd1.txt >nul 2>nul
del vid.ini >nul 2>nul
echo %pingtime%秒后窗口自动关闭
ping -n %pingtime% 127.0.0.1 >nul







2011/7/9 zhiwei chen <zhiweik在gmail.com>

> 在此我要说明一点,我用的是win7专业版正版系统,里面都是原装的东东。
> 对于以上有同学说win7可以加载boot.ini的情况,我想到了两点:1.win7先加载bcd然后加载boot.ini
> 2.win7为正版,被第三方修改过了。
>
> 我最近又尝试了几次,大概明白自己硬盘安装不成功的原因了、
> win7的启动管理器不能加载grldr或neogrub.mbr。 BCD的启动项已经加上了,但是不能正常使用。
> 我用过的方法,现在详细说明一下:
>
> 1. 直接在win7系统盘下新建个boot.ini文件,其他与winxp系统硬盘安装相同。
> 2. 使用easybcd新建启动项。
> 3. 使用bootice修改win7启动项。
>
> 2和3修改启动项是修改成功了,但是win7无法加载。说是找不到grldr或neogrub.mbr。
>
>
> 现在总结一下:win7启动项是修改好了,grldr文件内容正常,文件没有被破坏,但win7启动项就是没法加载(在win7启动菜单点击该启动项时提示文件不存在或已经被破坏)。我目前是用的wubi安装的,硬盘留下了60G空间,等着安装与win7平行的ubuntu。
>
> 2011/7/8 Shellexy Wang <jhuangjiahua在gmail.com>
>
> > 没试过不要随意下结论。
> >
> > 我自己的 win7 就用 boot.ini 写了 grub2 启动项。
> >
> > 你从默认没 boot.ini 怎么能推论出不读 boot.ini
> >
> > 2011/7/8 cat.s <llz916148在yahoo.com.cn>
> >
> > >
> 这个是有问题的,windows7的启动方式不一样,不会去读boot.ini。。。实际上,如果你装windows7,你都不会发现boot.ini。
> > >
> > > 启动方式已经完全变掉了,编辑windows7的启动菜单的命令是bcdedit。
> > >
> > >
> > >
> > -------------- next part --------------
> > An HTML attachment was scrubbed...
> > URL: <
> >
> https://lists.ubuntu.com/archives/ubuntu-zh/attachments/20110708/bff7b78b/attachment.html
> > >
> > --
> > ubuntu-zh mailing list
> > ubuntu-zh在lists.ubuntu.com
> > https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh
> >
> -------------- 下一部分 --------------
> 一个HTML附件被移除...
> URL: <
> https://lists.ubuntu.com/archives/ubuntu-zh/attachments/20110709/44079e81/attachment.html
> >
> --
> ubuntu-zh mailing list
> ubuntu-zh在lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh
>



-- 
     此致
敬礼
-------------- 下一部分 --------------
一个HTML附件被移除...
URL: <https://lists.ubuntu.com/archives/ubuntu-zh/attachments/20110709/7a7410b9/attachment.html>


关于邮件列表 ubuntu-zh 的更多信息