@echo off
COLOR f9
set vid=
set timeout=%~1
set gname=%~2
set gname2=boot\win7pe.wim
TITLE 设置绝对PE工具箱的BCD相关引导
:bcd_1
bcdedit >temp_bcd.txt
type temp_bcd.txt | find "%gname2%" >nul && goto un_bcd_1
bcdedit.exe /create -device > %windir%\SYSTEM32\win7ram.ini
for,/f,"tokens=2 delims={",%%i,In (%windir%\SYSTEM32\win7ram.ini) Do (
set vidb=%%i
)
for,/f,"tokens=1 delims=}",%%i,In ("%vidb%") Do (
set vidram={%%i}
)
echo %vidram%>%windir%\SYSTEM32\win7ram.ini
bcdedit.exe /set %vidram% ramdisksdidevice partition=%systemdrive% >nul
bcdedit.exe /set %vidram% ramdisksdipath \boot\win7pe.sdi >nul
bcdedit /create /d "%gname%" /application OSLOADER >%windir%\SYSTEM32\win7pe.ini
for,/f,"tokens=2 delims={",%%i,In (%windir%\SYSTEM32\win7pe.ini) Do (
set vida=%%i
)
for,/f,"tokens=1 delims=}",%%i,In ("%vida%") Do (
set vid={%%i}
)
echo %vid%>%windir%\SYSTEM32\win7pe.ini
bcdedit /set %vid% device "ramdisk=[%systemdrive%]\%gname2%,%vidram%" >nul
bcdedit /set %vid% path "\windows\system32\boot\winload.exe" >nul
bcdedit /set %vid% osdevice "ramdisk=[%systemdrive%]\%gname2%,%vidram%" >nul
bcdedit /set %vid% systemroot "\windows" >nul
bcdedit /set %vid% detecthal "YES" >nul
bcdedit /set %vid% winpe "YES" >nul
bcdedit /displayorder %vid% /addlast >nul
bcdedit /timeout %timeout% >nul
goto exit
:un_bcd_1
If Not Exist %windir%\SYSTEM32\win7pe.ini goto exit
for,/f,"tokens=1",%%i,In (%windir%\SYSTEM32\win7pe.ini) Do (
set vid=%%i
)
bcdedit /delete %vid% /cleanup >nul
del %windir%\SYSTEM32\win7pe.ini
for,/f,"tokens=1",%%i,In (%windir%\SYSTEM32\win7ram.ini) Do (
set vidram=%%i
)
bcdedit /delete %vidram% /cleanup >nul
del %windir%\SYSTEM32\win7ram.ini
goto bcd_1
:exit
del temp_bcd.txt
@echo off
COLOR f9
set vid=
set gname2=boot\win7pe.wim
TITLE 删除绝对PE工具箱的BCD相关引导
If Not Exist %windir%\SYSTEM32\win7pe.ini exit
for,/f,"tokens=1",%%i,In (%windir%\SYSTEM32\win7pe.ini) Do (
set vid=%%i
)
bcdedit /delete %vid% /cleanup >nul
If Not Exist %windir%\SYSTEM32\win7ram.ini exit
for,/f,"tokens=1",%%i,In (%windir%\SYSTEM32\win7ram.ini) Do (
set vidram=%%i
)
bcdedit /delete %vidram% /cleanup >nul
bcdedit /timeout 0 >nul
del %windir%\SYSTEM32\win7pe.ini
del %windir%\SYSTEM32\win7ram.ini
del %windir%\SYSTEM32\temp_bcd.txt
del %windir%\SYSTEM32\DELBOOT.CMD
欢迎光临 无忧启动论坛 (http://wuyou.net./) | Powered by Discuz! X3.3 |