title [] 安装NT6系统(Shift+F10)
set isopath=iso
set isoname=win7x86.iso
find --set-root /%isopath%/Setup.bat
write --offset=0 ()/%isopath%/Setup.bat start template.bat %isopath% %isoname%
map ()/%isopath%/%isoname% (0xff)
map --hook
chainloader (0xff)
以上方法后会向setup.bat中写入一行调用template.bat的指令,同时传入两个参数.
template.bat:
@echo off
set isopath=%1
set isoname=%2
cd /d %cd%
if not exist "%cd%\%isoname%" goto error
echo.
echo ISO镜像文件:%cd%\%isoname%
set isodrive=""
for %%i in (R,S,T.X,Y,Z) do if not exist %%i: set isodrive=%%i
if %isodrive%=="" goto error else goto load
:load
echo.
echo 加载镜像到: %isodrive% 盘
"%cd%\loadiso.exe" /D:%isodrive% /I:%cd%\%isoname%
echo.
echo 请按任意键开始安装:
pause>nul
echo.
echo 正在启动安装程序,请稍候几秒......
start %isodrive%:\sources\setup.exe
exit
:error
echo.
echo 出错了
pause >nul
exit