本文内容借鉴腾龙工作室内文件,https://www.tenlonstudio.com/5602.html
#!ipxe
#============== Set Variables ===============
#设置默认时间
set menu-timeout 16000
#判断启动平台的方式,设定默认启动项
iseq ${platform} efi && set menu-default win64 || set menu-default win32
#将http用xieyi代替
set xieyi:string http
#测试是否存在ip,否则dhcp自动获取
isset ${ip} || dhcp
#测试是否存在dhcp服务器,否则指定next-server为192.168.0.101
isset ${next-server} || set next-server 192.168.0.101
#============== Set Menu ===============
#菜单开始标记
:start
#显示menu标题,并显示平台和ip地址
menu iPXE Boot Menu --${platform}--${ip}
#列项,可以指定热键,别名,添加--gap --分割线
item --gap -- -------------------------------- WINPE TOOL ---------------------------
item win32 Windows10PE x32
item win64 Windows10PE x64
item --gap -- ----------------------------------- TOOL ------------------------------
item maxdos MaxDOS 9.1
item --gap -- -------------------------------- Advanced -----------------------------
item --key h local [H]Boot from local drive
item --key s shell [S] Drop to iPXE Shell
item --key r reboot [R] Reboot the Computer
item --key x exit [X] Exit iPXE and Continue BIOS Booting
item --key c config [C]Configure settings
item --key m msboot [M]Enter Windows Boot Manager Menu (BIOS)
#在默认时间到时选择默认启动项
choose --timeout ${menu-timeout} --default ${menu-default} selected
goto ${selected}
#============ Main Menu Options =============
#启动32位PE,将PE32.wim赋值给pefile,并跳转至bootpe
:win32
set pefile PE32.wim
goto bootpe
#启动64位PE,将PE64.wim赋值给pefile,并跳转至bootpe
:win64
set pefile PE64.wim
goto bootpe
#PE镜像启动代码块==============================
:bootpe
kernel ${xieyi}://${next-server}/boot/wimboot gui || goto retry
initrd ${xieyi}://${next-server}/pxeautorun.txt ${next-server}.cmd || goto nextg
:nextg
initrd ${xieyi}://${next-server}/boot/boot.sdi boot.sdi || goto retry
iseq ${platform} pcbios || goto winefi
initrd ${xieyi}://${next-server}/bootmgr.exe bootmgr.exe || goto retry
initrd ${xieyi}://${next-server}/boot/bxe bxd || goto retry
initrd ${xieyi}://${next-server}/boot/${pefile} boot.WIM || goto retry
boot || goto retry
goto start
:retry
imgfree
prompt Error! press any key to retry
goto start
#PE镜像启动代码块==============================
#启动MaxDOS镜像
:maxdos
kernel ${boot-url}/memdisk
initrd ${boot-url}/MAXDOS9.img
boot
#从本地硬盘启动
:local
sanboot --no-describe --drive 0x80
#打开命令行
:shell
echo Type 'exit' to go back to the menu.
shell
goto start
#重启
:reboot
reboot
#退出
:exit
exit
#配置
:config
config
goto start
#更换启动文件
:msboot
chain tftp://${next-server}/pxelinux.0
goto start