2010/2/4 │老桃毛的winpe安装批处理

作者:逍遥乾坤 | 发表时间:2010/2/4 11:57:13 | 分类:网络随笔 | 阅读:5967 | 评论:1994
@Echo Off
COLOR 2F
Set Prog=老毛桃制作的 WinPE 专用安装工具
Set L1=      ╭══════════════════╮
Set L2=      ║                  ║
Set L3=   ╭══┤ %Prog%  ├══╮
Set L4=   ║  ║                  ║  ║
Set L5=   ║  ╰══════════════════╯  ║
Set L6=   ║                        ║
Set L7=   ╟════════════════════════╢
Set L8=   ║ 版权所有:老毛桃  仅供网友们交流 翻版不究 ║
Set L9=   ╰────────────────────────╯
Title %Prog%

Set PEFile=WinPE.IS_
Set PEIni=外置程序\WinPE.INI
Set LogFile=PEInstall.log
Set AddATTR=ATTRIB +S +H +R
Set DelATTR=ATTRIB -S -H -R

:Start
CLS
Title %Prog%——安装
Echo.
Echo %L1%
Echo %L2%
Echo %L3%
Echo %L4%
Echo %L5%
Echo %L6%
Echo    ║  请选择安装方式:               ║
Echo %L6%
Echo    ║  [1] 普通安装/启动 (硬盘安装)        ║
Echo    ║  [2] Grub安装/启动 (硬盘安装,支持 MD5 密码) ║
Echo    ║  [3] Aero安装/启动 (硬盘安装,支持密码)   ║
Echo    ║  [4] Grub安装/启动 (U 盘安装,支持 MD5 密码) ║
Echo    ║  [Q] 退出安装                ║
Echo %L6%
Echo %L7%
Echo    ║ 注意: Aero 安装项只适合系统分区在(HD0,0)分区  ║
Echo %L7%
Echo %L8%
Echo %L9%
Echo.
Set Choice=
Set /P Choice=   请选择要进行的操作 (1/2/3/4/Q) ,然后按回车:
If "%Choice%"=="" Goto Start
If Not "%Choice%"=="" Set Choice=%Choice:~0,1%
If /I "%Choice%"=="1" Goto HD
If /I "%Choice%"=="2" Goto HD
If /I "%Choice%"=="3" Goto HD
If /I "%Choice%"=="4" Goto UD
If /I "%Choice%"=="Q" Exit
Goto Start

:HD
For %%I In (Z Y X W V U T S R Q P O N M L K J I H G F E D C) Do If Exist %%I:\BOOT.INI Set RP=%%I:
If "%RP%"=="" Goto NoSys
Set PEDIR=%RP%\MAOTAO
Set TargetP=硬盘&&Set TxtSp=
If Exist %PEDIR% Goto Err1
FIND /I "C:\MAOTAO" %RP%\BOOT.INI>NUL 2>NUL
If "%Errorlevel%"=="0" Goto Err1
If /I "%Choice%"=="1" Goto Install
If /I "%Choice%"=="2" Goto GInstall
If /I "%Choice%"=="3" Goto AInstall
Goto HD

:UD
CLS
Title %Prog%——U 盘安装
If "%NoUD%"=="Yes" Echo 错误:您设定的分区不存在或写保护或不是 U 盘分区,请按任意键重新设定。&&Echo.
Set /P RP=请选择您的 U 盘盘符(不需要冒号,例如 F):
Echo.&&Echo.
If "%RP%"=="" Goto UD
If Not "%RP%"=="" Set RP=%RP:~0,1%:
Grub2U\FSUTIL.EXE FSINFO DRIVETYPE %RP%|FIND "可移动驱动器">NUL 2>NUL
If Not "%Errorlevel%"=="0" Set NoUD=Yes&&Goto UD
Set TestFile=%RP%\MaotaoTest_%RANDOM%.MT
Cd.>%TestFile%
If Not Exist %TestFile% Set NoUD=Yes&&Goto UD
Del %TestFile% /Q>NUL 2>NUL
Set U=U&&Set PEDIR=%RP%\MAOTAO&&Set OP=%RP%&&Set TargetP= U 盘
If Exist %PEDIR% Goto Err1
CLS
Echo 您选择的 U 盘分区为 %RP%,下面将对您的 U 盘进行格式化并写入引导
Echo.
Echo 请严格按照相关工具软件界面中的提示操作,以防出错。请按任意键开始。。。
PAUSE>NUL
Start /Wait Grub2U\HPUSBFW.EXE
Start /Wait Grub2U\GRUBGUI.EXE
Echo.
Echo 您的 U 盘已经成功格式化并写入了 Grub 引导,请按任意键继续。。。
PAUSE>NUL
Goto GInstall

:Err1
CLS
Title %Prog%——卸载
Echo.
Echo %L1%
Echo %L2%
Echo %L3%
Echo %L4%
Echo %L5%
Echo %L6%
Echo    ║ 您的%TargetP%中好像已经安装了 WinPE,您想怎么办?%TxtSp% ║
Echo %L6%
Echo    ║  [1] 卸载原有的 WinPE,并且重新安装。    ║
Echo    ║  [2] 卸载原有的 WinPE,并且不再安装。    ║
Echo    ║  [B] 返回首页,重新选择安装选项。      ║
Echo    ║  [Q] 退出安装                ║
Echo %L6%
Echo %L7%
Echo %L8%
Echo %L9%
Echo.
Set Choice=
Set /P Choice=   请选择要进行的操作 (1/2/B/Q) ,然后按回车:
If "%Choice%"=="" Goto Err1
If Not "%Choice%"=="" Set Choice=%Choice:~0,1%
If /I "%Choice%"=="1" Set Choi=1&&Goto UnInstall
If /I "%Choice%"=="2" Goto UnInstall
If /I "%Choice%"=="B" Goto Start
If /I "%Choice%"=="Q" Exit
Goto Err1
Exit

:UnInstall
If Exist %RP%\LDRXPE %DelATTR% %RP%\LDRXPE&&Del %RP%\LDRXPE /Q>NUL 2>NUL
If Exist %RP%\WINNT.XPE %DelATTR% %RP%\WINNT.XPE&&Del %RP%\WINNT.XPE /Q>NUL 2>NUL
If Exist %RP%\MTLDR.PE %DelATTR% %RP%\MTLDR.PE&&Del %RP%\MTLDR.PE /Q>NUL 2>NUL
If Exist %RP%\MTLDR %DelATTR% %RP%\MTLDR&&Del %RP%\MTLDR /Q>NUL 2>NUL
If Exist %RP%\%LogFile% For /F "eol=; tokens=2 delims=^=" %%i In ('find /I ^"WinPE外挂位置^" %RP%\%LogFile%') do SET OPU=%%i
If Not "%U%"=="" Set OPU=%OP%
If Exist %OPU%\外置程序 RD %OPU%\外置程序 /S /Q>NUL 2>NUL
If Exist %RP%\%LogFile% %DelATTR% %RP%\%LogFile%&&Del %RP%\%LogFile% /Q>NUL 2>NUL
If Exist %RP%\MAOTAO RD %RP%\MAOTAO /S /Q>NUL 2>NUL
%DelATTR% %RP%\BOOT.INI>NUL 2>NUL
If Exist %RP%\BOOT.BAK (
%DelATTR% %RP%\BOOT.BAK
TYPE %RP%\BOOT.BAK|FIND /I /V "C:\MAOTAO">%RP%\BOOT.INI
) Else (
If Exist %RP%\BOOT.INI Copy %RP%\BOOT.INI %RP%\BOOT.BAK /Y>NUL 2>NUL
If Exist %RP%\BOOT.BAK TYPE %RP%\BOOT.BAK|FIND /I /V "C:\MAOTAO">%RP%\BOOT.INI
)
If Exist %RP%\BOOT.BAK %DelATTR% %RP%\BOOT.BAK&&Del %RP%\BOOT.BAK>NUL 2>NUL
If Exist %RP%\BOOT.INI %AddATTR% %RP%\BOOT.INI
Title %Prog%——卸载完成
If "%Choi%"=="1" (Echo.&&Echo.&&Echo    卸载完成,请按任意键准备安装 。。。&&PAUSE>NUL 2>NUL&&Goto Start)
Echo.&&Echo.&&Echo    卸载完成,请按任意键退出 。。。
PAUSE>NUL 2>NUL
Exit

:Install
Title %Prog%——普通安装
If "%OP%"=="" Call :SetOP
If Not Exist %PEDIR% MD %PEDIR%>NUL 2>NUL
If Exist %RP%\LDRXPE %DelATTR% %RP%\LDRXPE
If Exist %RP%\WINNT.XPE %DelATTR% %RP%\WINNT.XPE
Echo 正在复制文件,请稍候 。。。
MyIns\MyIns.exe e MyIns\MyIns.dll -o%PEDIR% MAOTAO.BIN -r -y>NUL 2>NUL
MyIns\MyIns.exe e MyIns\MyIns.dll -o%RP%\ WINNT.XPE -r -y>NUL 2>NUL
Call :CopyAndSetFiles
Goto SUCCESS

:GInstall
If "%U%"=="" Title %Prog%——Grub安装
CLS
Set DefItem=0&&Set LDRP=MAOTAO\
If "%U%"=="" Set DefItem=1&&If "%OP%"=="" Call :SetOP
Echo 请输入您要设定的密码
Echo 注意:密码中不许有空格、"\"、引号等特殊字符
Echo.
Set /P Pass1=请输入:
If "%Pass1%"=="" Goto GInstall
Echo.&&Echo.
Echo 请再一次输入您的密码
Echo.
Set /P Pass2=请再次输入:
If "%Pass2%"=="" Goto GInstall
If Not "%Pass2%"=="%Pass1%" Echo.&&Echo 您两次输入的密码不一致,请重新输入&&Echo 请按任意键重新开始设置密码&&PAUSE>NUL 2>NUL&&Goto GInstall
If Not Exist %PEDIR% MD %PEDIR%>NUL 2>NUL
>%PEDIR%\MD5P.TMP MD5.EXE %PEDIR%\MD5P.TMP %PEDIR%\MD5R.TXT>NUL 2>NUL
MyIns\MyIns.exe e MyIns\MyIns.dll -o%RP% MTLDR -r -y>NUL 2>NUL
MyIns\MyIns.exe e MyIns\MyIns.dll -o%PEDIR% MTLDR%U%.BIN -r -y>NUL 2>NUL
>>%RP%\MTLDR Echo default %DefItem%
>>%RP%\MTLDR Echo timeout 5
>>%RP%\MTLDR Echo.
For /f %%i In ('type %PEDIR%\md5r.txt') do echo password --md5 %%i>>%RP%\MTLDR
Echo fontfile /maotao/muifont.gz>>%RP%\MTLDR
Echo splashimage /maotao/bj2008.xpm.gz>>%RP%\MTLDR
>>%RP%\MTLDR Echo.
Echo title WinPE By: Maotao>>%RP%\MTLDR
For /f %%i In ('type %PEDIR%\md5r.txt') do echo password --md5 %%i>>%RP%\MTLDR
Copy /b %RP%\MTLDR+%PEDIR%\MTLDR%U%.bin %RP%\MTLDR>NUL 2>NUL
Del %PEDIR%\MD5?.* /Q>NUL 2>NUL
Del %PEDIR%\MTLDR%U%.bin /Q>NUL 2>NUL
Echo.
Echo 密码设置完成,请牢记您的密码,并按任意键继续 。。。
PAUSE>NUL 2>NUL
If Exist %RP%\LDRXPE %DelATTR% %RP%\LDRXPE
If Exist %RP%\WINNT.XPE %DelATTR% %RP%\WINNT.XPE
If Exist %RP%\MTLDR %DelATTR% %RP%\MTLDR
Echo.
Echo 正在复制文件,请稍候 。。。
MyIns\MyIns.exe e MyIns\MyIns.dll -o%PEDIR% BJ2008.XPM.GZ -r -y>NUL 2>NUL
MyIns\MyIns.exe e MyIns\MyIns.dll -o%PEDIR% muifont.gz -r -y>NUL 2>NUL
If "%U%"=="" MyIns\MyIns.exe e MyIns\MyIns.dll -o%PEDIR%\ maotaog.bin -r -y>NUL 2>NUL
MyIns\MyIns.exe e MyIns\MyIns.dll -o%RP%\ WINNT.XPE -r -y>NUL 2>NUL
If "%U%"=="" Ren %PEDIR%\maotaog.bin maotao.bin
Call :CopyAndSetFiles
Goto SUCCESS

:AInstall
Title %Prog%——Aero安装
CLS
If "%OP%"=="" Call :SetOP
Echo 请输入您要设定的密码
Echo 注意:密码中不许有空格、"\"、引号等特殊字符
Echo.
Set /P Pass1=请输入:
If "%Pass1%"=="" Goto AInstall
Echo.&&Echo.
Echo 请再一次输入您的密码
Echo.
Set /P Pass2=请再次输入:
If "%Pass2%"=="" Goto AInstall
If Not "%Pass2%"=="%Pass1%" Echo.&&Echo 您两次输入的密码不一致,请重新输入&&Echo 请按任意键重新开始设置密码&&PAUSE>NUL 2>NUL&&Goto AInstall
If Not Exist %PEDIR% MD %PEDIR%>NUL 2>NUL
For /f %%i In (MyIns\Aero.sys) Do MyIns\MyIns.exe e MyIns\MyIns.dll -o%PEDIR% %%i -r -y>NUL 2>NUL
Ren %PEDIR%\maotao.bin avldr.xpe
Ren %PEDIR%\maotaoa.bin maotao.bin
>%PEDIR%\airL.gz Copy /B %PEDIR%\airT.gz+%PEDIR%\airL.gz+%PEDIR%\airW.gz %PEDIR%\airmenu.ini>NUL 2>NUL&&Del %PEDIR%\air?.gz /Q>NUL 2>NUL>NUL 2>NUL
MyIns\MyIns.exe a -tGZip %PEDIR%\airmenu.gz %PEDIR%\airmenu.ini -w%PEDIR%>NUL 2>NUL&&Del %PEDIR%\airmenu.ini /Q>NUL 2>NUL&&Ren %PEDIR%\airmenu.gz airmenu.ini>NUL 2>NUL
Echo.
Echo 密码设置完成,请牢记您的密码,并按任意键继续 。。。
PAUSE>NUL 2>NUL
If Exist %RP%\LDRXPE %DelATTR% %RP%\LDRXPE
If Exist %RP%\WINNT.XPE %DelATTR% %RP%\WINNT.XPE
Echo.
Echo 正在复制文件,请稍候 。。。
MOVE %PEDIR%\MTLDR.PE %RP%\>NUL 2>NUL
MOVE %PEDIR%\WINNT.XPE %RP%\>NUL 2>NUL
Call :CopyAndSetFiles
Goto SUCCESS

:NoSys
CLS
Echo 好像您的机器中没有安装操作系统哦,请确认后再执行本安装程序。
Echo.
Echo 请按任意键退出 。。。
PAUSE>NUL 2>NUL
Exit

:CopyAndSetFiles
For /F "tokens=2 delims=." %%i In ('Ver') DO Set SysVer=%%i
If "%U%"=="" If %SysVer:~0,1% LSS 1 Set SysVer=2K
MyIns\MyIns.exe e MyIns\MyIns.dll -o%RP%\%LDRP% LDRXPE -r -y>NUL 2>NUL
If Not Exist %RP%\NTDETECT.COM MyIns\MyIns.exe e MyIns\MyIns.dll -o%RP% NTDETECT.COM -r -y>NUL 2>NUL
Copy ..\%PEFile% %PEDIR% /Y>NUL 2>NUL
If "%U%"=="" %DelATTR% %RP%\BOOT.INI
If "%U%"=="" If Exist %RP%\BOOT.BAK %DelATTR% %RP%\BOOT.BAK
If "%U%"=="" Copy %RP%\BOOT.INI %RP%\BOOT.BAK>NUL 2>NUL
If "%U%"=="" TYPE %RP%\BOOT.BAK|FIND /I /V "C:\MAOTAO">%RP%\BOOT.INI
If "%U%"=="" Echo C:\MAOTAO\MAOTAO.BIN="WinPE By: 老毛桃">>%RP%\BOOT.INI
If /I "%SysVer%"=="2K" (
%DelATTR% %RP%\NTLDR&&%DelATTR% %RP%\bootfont.bin
Ren %RP%\NTLDR NTLDR.2K&&Ren %RP%\bootfont.bin bootfont.bin.2K
MyIns\MyIns.exe e MyIns\MyIns.dll -o%RP% NTLDR -r -y>NUL 2>NUL
MyIns\MyIns.exe e MyIns\MyIns.dll -o%RP% bootfont.bin -r -y>NUL 2>NUL
)
XCOPY ..\外置程序 /E %OP%\外置程序\ /Y /H /R>NUL 2>NUL
If Exist %OP%\%PEIni% %DelATTR% %OP%\%PEIni%
TYPE ..\%PEIni%|FIND /I /V "安装.EXE">%OP%\%PEIni%
>>%RP%\WINNT.XPE %AddATTR% %RP%\%LDRP%LDRXPE
%AddATTR% %RP%\NTDETECT.COM
%AddATTR% %RP%\WINNT.XPE
If "%U%"=="" %AddATTR% %RP%\BOOT.INI
%AddATTR% %RP%\MAOTAO /S /D
%AddATTR% %RP%\MAOTAO\*.* /S /D
%AddATTR% %OP%\外置程序 /S /D
%AddATTR% %OP%\外置程序\*.* /S /D
If Exist %RP%\MTLDR.PE %AddATTR% %RP%\MTLDR.PE
If Exist %RP%\MTLDR %AddATTR% %RP%\MTLDR
If "%U%"=="" Call :AddLog
Goto :EOF

:AddLog
>%RP%\%LogFile% Cd.
>>%RP%\%LogFile% Echo ;此文件为 WinPE 的安装日志文件,请不要随意删除
>>%RP%\%LogFile% Echo ;否则可能会造成 WinPE 的卸载不够彻底!!!
>>%RP%\%LogFile% Echo.
>>%RP%\%LogFile% Echo WinPE镜像文件=%PEFile%
>>%RP%\%LogFile% Echo WinPE外挂位置=%OP%
>>%RP%\%LogFile% Echo WinPE安装日期=%Date% %Time%
%AddATTR% %RP%\%LogFile%
Goto :EOF

:SetOP
CLS
If "%NoOP%"=="Yes" Echo 错误:您设定的分区不存在或写保护,请按任意键重新设定。&&Echo.
Set /P OP=请设定 外置程序 存放的分区符(不需要冒号,例如 D):
Echo.&&Echo.
If "%OP%"=="" Goto SetOP
If Not "%OP%"=="" Set OP=%OP:~0,1%:
Set TestFile=%OP%\MaotaoTest.MT
Cd.>%TestFile%
If Not Exist %TestFile% Set NoOP=Yes&&Goto SetOP
Del %TestFile% /Q>NUL 2>NUL
Goto :EOF

:SUCCESS
Title %Prog%——安装完成
CLS
Echo 已经成功将镜像 %PEFile% 安装到您的 %RP% 盘。
If "%U%"=="" (
Echo 外置程序 文件夹按照您的设置,复制到了 %OP% 盘。
Echo.
Echo 系统分区中的 BOOT.INI 备份为 BOOT.BAK。
)
Echo.&&Echo.
Echo 如果您需要将 WinPE 卸载,请重新运行本安装程序。
Echo.
Echo 请按任意键退出 。。。
PAUSE>NUL 2>NUL
Exit

评论

  • propsart.com:
  • jordan elephant print hats girl billig how much are nike roshes miami dolphins hat and scarf sets adidas eqt equipment running support education air jordan future negro hombres knitted baby boy hats for sale jacksonville billig
    propsart.com http://www.propsart.com./(2019/8/21 16:38:21)
  • lagruere:
  • women 2014 new nfl jerseys detroit lions 20 barry sanders white jerseys billig new air jordan cp3.x gr氓 sko til salg svart hvit nike air flight 89 til uk adidas gazelle 2 svart hvit nfl knit hats for dogs for sale billig nike air max 87 ultra flyknit hvid r酶d pure platinum wolf gr氓
    lagruere http://www.lagruere.com/(2019/8/20 1:11:04)
  • nasdaqim:
  • mercurial superfly iv test wholevendita jordan 13 tutti nero new york mets star wars hat zionsville indiana maschio nike air vapormax plus oro nero nhl jerseys montreal canadiens 46 andrei kostitsyn red pinstripe jerseys billig mens asics gel quantum 360 all white
    nasdaqim http://www.nasdaqim.com/(2019/8/20 0:50:20)
  • sheadore:
  • blue red white new air jordan 14 gs adidas nemeziz 17+ black silver oakland raiders hat vintage air max typha zip pittsburgh pirates trucker hats reddit nike air presto mens all black shoes
    sheadore http://www.sheadore.com/(2019/8/16 16:34:36)
  • rankarab:
  • elite sam acho mens jersey arizona cardinals 94 home red nfl billig new era nfl on field knit hats abercrombie and fitch billig nfl minnesota vikings just do it blue t shirt billig
    rankarab http://www.rankarab.com/(2019/8/14 19:28:12)
  • 逍遥乾坤:
  • 这个只供学习而用,如果真要用做u盘装系统,必须配有其他工具!(2010/2/5 10:36:30)

发表评论

  • 昵称:
  • 邮箱: (可选,保密)
  • 网址: (可选)
  • QQ: (可选,保密)
  • 内容:
  • 验证码: