|
本帖最后由 oym2016 于 2022-5-24 20:32 编辑
::Restore.cmd
::放在目录中可手动恢复 :放入注册表可自动恢复
@ECHO off&PUSHD %~dp0 & REG.EXE QUERY "HKU\S-1-5-19">NUL 2>&1
IF %ERRORLEVEL% EQU 1 ( CMD /U /C ECHO. CreateObject^("Shell.Application"^).ShellExecute "%~f0", "", "", "runas", 1 > "%Temp%\GetAdmin.vbs"& "%Temp%\GetAdmin.vbs" & DEL "%Temp%\GetAdmin.vbs" & EXIT /B )
setlocal enabledelayedexpansion
SET dif=Basevhd.vhdx
SET Sub_1=BaseSub_1.vhdx
SET Sub_2=BaseSub_2.vhdx
IF NOT EXIST %~dp0!dif! goto :first
:restore
IF EXIST GrubSign.? DEL /f /q GrubSign.?
COPY /y %~dp0!dif! %~dp0!Sub_1! >nul 2>nul
IF errorlevel 1 (
COPY /y %~dp0!dif! %~dp0!Sub_2!
ECHO GrubSign2 >GrubSign.2
) ELSE (
ECHO GrubSign1 >GrubSign.1
)
:end
EXIT
:first
SET sys=Win81Ent.vhdx
ECHO create vdisk file=%~dp0!dif! parent="%~dp0!sys!"|DISKPART >nul
COPY /y %~dp0!dif! %~dp0!Sub_1!
ECHO GrubSign1 >GrubSign.1
exit
=====================================
::G4D菜单
title ntloader 启动 Win81Ent.VHDx (kernel方案1)
find --set-root /Win81Ent/Basevhd.vhdx
uuid ()
if exist GrubSign.1 set vhdn=/Win81Ent/BaseSub_1.vhdx
if exist GrubSign.2 set vhdn=/Win81Ent/BaseSub_2.vhdx
find --set-root /efi/grub/ext/ntloader
kernel /efi/grub/ext/ntloader uuid=%?% file=%vhdn%
initrd /efi/grub/ext/initrd.lz1
::grub2菜单
menuentry "Windows 8.1 Vhdx" --class windows {
if search -n -s -f /Win81Ent/GrubSign.1;then
ntboot --efi=/Win81Ent/bootmgfw.efi --vhd /Win81Ent/BaseSub_1.vhdx
elif
search -n -s -f /Win81Ent/GrubSign.2;then
ntboot --efi=/Win81Ent/bootmgfw.efi --vhd /Win81Ent/BaseSub_2.vhdx
fi;
}
|
评分
-
查看全部评分
|