标题: [其他] 求助:把默认PE安装到容量最大的盘的批处理修改为安装到系统盘 [打印本页]
作者: hfstar 时间: 2021-8-30 14:18 标题: 求助:把默认PE安装到容量最大的盘的批处理修改为安装到系统盘
本帖最后由 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
复制代码
作者: newswan 时间: 2021-8-30 14:53
本帖最后由 newswan 于 2021-8-30 19:54 编辑
- @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
- )
-
- set vol=%SystemDrive%
-
- :InstPE
- ECHO 安装PE到 %vol% 盘
- if not exist %vol%\BOOT md %vol%\BOOT
- copy /y .\*.wim %vol%\BOOT\
- copy /y .\BOOT.SDI %vol%\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=%vol%
- bcdedit /set %id2% ramdisksdipath \boot\boot.sdi
- bcdedit /create %id1% /d "Windows 10 PE 维护平台" /application osloader
- bcdedit /set %id1% device ramdisk=[%vol%]\boot\1064.WIM,%id2%
- bcdedit /set %id1% osdevice ramdisk=[%vol%]\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 %vol%\BOOT
- goto:eof
复制代码
作者: hfstar 时间: 2021-8-30 15:12
回复 2# newswan
多谢多谢!
作者: newswan 时间: 2021-8-30 19:55
先有个错误复制代码
要改成复制代码
作者: hfstar 时间: 2021-8-30 22:05
本帖最后由 hfstar 于 2021-8-30 22:09 编辑
呵呵,没事,这个我发现了,批处理的变量必须加俩英文的%%
作者: 窄口牛 时间: 2021-8-31 06:47
没必要最大的盘哇,esp分区分的大点,wim加一百兆就够了。legacy下就替换掉系统的re好了。
作者: hfstar 时间: 2021-8-31 16:26
回复 6# 窄口牛
哦哦,多谢指点
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |