本帖最后由 hfstar 于 2021-8-30 14:21 编辑
这个批处理是把PE安装到容量最大的一个盘,如果我要把PE修改了安装在系统盘,怎么修改呢?向各位求助一下。- @echo off
- color 3F
- setlocal EnableDelayedExpansion
-
- bcdedit /enum {current}|find "system32\winload.exe">nul
- if %errorlevel% equ 1 (
- set bootmode=uefi
- set winload=winload.efi
- ) else (
- set bootmode=bios
- set winload=winload.exe
- )
-
- for /f "tokens=1-5 delims= " %%a in ('drvtype -a ^|find ":"') do set HDDList=%%d
-
- for %%b in (!HDDList!) do (
- set tmpVol=%%b
- call :check
- if /i "!judge!" == "ok" (
- if /i "%bootmode%" == "uefi" (
- if exist !tmpVol!\EFI\Microsoft\Boot\BCD set efi=!tmpVol!
- )
- )
- set LastVol=!tmpVol!
- )
-
- if not "!efi!"== "" set LastVol=!efi!
- call :InstPE
- pause & exit
-
-
- :check
- for /f "tokens=1-4 delims= " %%i in ('dir %tmpVol% ^|find /i "可用字节"') do (
- set space=%%k
- )
- set space=!space:,=!
- if !space! lss 50000000 (set judge=err) else set judge=ok
- goto:eof
-
-
-
- :InstPE
- ECHO 安装PE到 %lastvol% 盘
- if not exist %LastVol%\BOOT md %LastVol%\BOOT
- copy /y .\*.wim %LastVol%\BOOT\
- copy /y .\BOOT.SDI %LastVol%\BOOT\
- del .\*.wim
- bcdedit.exe /timeout 9
- bcdedit.exe /set {current} bootmenupolicy Legacy
- set id1={%time:~6,2%%time:~9,2%ffff-8d96-11de-8e71-fffffffffffa}
- set id2={%time:~6,2%%time:~9,2%ffff-8d96-11de-8e71-fffffffffffb}
- bcdedit /create %id2% /d "Windows 10 PE 维护平台" /device
- bcdedit /set %id2% ramdisksdidevice partition=%LastVol%
- bcdedit /set %id2% ramdisksdipath \boot\boot.sdi
- bcdedit /create %id1% /d "Windows 10 PE 维护平台" /application osloader
- bcdedit /set %id1% device ramdisk=[%LastVol%]\boot\1064.WIM,%id2%
- bcdedit /set %id1% osdevice ramdisk=[%LastVol%]\boot\1064.WIM,%id2%
- bcdedit /set %id1% path \windows\system32\boot\%winload%
- bcdedit /set %id1% description "Windows 10 PE 维护平台"
- bcdedit /set %id1% locale zh-CN
- bcdedit /set %id1% inherit {bootloadersettings}
- bcdedit /set %id1% systemroot \windows
- bcdedit /set %id1% detecthal Yes
- bcdedit /set %id1% winpe Yes
- bcdedit /set %id1% ems no
- bcdedit /displayorder %id1% /addlast
- attrib +r +h +s +a %LastVol%\BOOT
- goto:eof
复制代码
|