|
@echo Off rem =================== rem UEFI启动U盘制作脚本 rem =================== rem 变量说明: %numd%—磁盘编号 %letp%—盘符 rem 中间文件说明 list1.txt-磁盘列表文件,用于获取U盘磁盘编号 rem 中间文件说明 list2.txt-分区列表文件,用于获取分区编号盘符类型 echo 获取管理员权限 %1 mshta vbscript:createobject("shell.application").shellexecute("""%~0""","::",,"runas",1)(window.close)&& exit echo 设置当前目录为脚本所在目录 cd /d %~dp0 echo 可移动磁盘列表 pa\partassist.exe /list /usb echo 获取磁盘编号,多个U盘时选择最后一个。 pa\partassist.exe /list /usb /out:list1.txt echo. Set numd= for %%j in (1 2 3 4 5 6 7 8 9 10 11 12) DO (find /i "%%j |" list1.txt>nul&&SET numd=%%j) if not defined numd echo 找不到U盘,无法制作自动退出!!!!&&del list1.txt /q&&pause&&goto :eof del list1.txt /q echo 默认选择磁盘%numd%,其所有分区列表 pa\partassist.exe /list:%numd% echo. pa\partassist.exe /list:%numd% /out:list2.txt echo 获取U盘分区盘符,多个盘符时选择最前盘符 Set letp= for %%i in (Z Y X W U T S R Q P O N M L K J I H G F E D C) DO (find /i "%%i:" list2.txt>nul&&SET letp=%%i) if not defined letp echo 找不到U盘盘符,无法制作自动退出&&del list2.txt /q&&pause&&goto :eof del list2.txt /q echo. Echo UEFI启动U盘制作脚本 echo ================================================== echo 磁盘%numd% (%letp%:)将被制作成启动U盘 echo. echo 磁盘%numd% (%letp%:)里的所有数据将会丢失,请注意备份。 echo. echo 要取消本脚本请关闭此窗口 echo. echo 要继续制作启动盘请按任意键... echo ================================================== pause>nul Echo. echo 删除U盘所有分区 pa\partassist.exe /hd:%numd% /del:all Echo. echo 创建并格式化右端的ntfs区,55000M,ntfs,4k对齐,不激活,不设置隐藏属性,设置卷标为data pa\partassist.exe /hd:%numd% /cre /pri /size:55000 /end /fs:ntfs /align /label:DATA Echo. echo 在左端未分配空间中新建fta32格式区,并设置卷标为efi,4k对齐,自动分配盘符 pa\partassist.exe /hd:%numd% /cre /pri /size:auto /fs:fat32 /act /align /label:EFI /letter:auto set src=%~dp0 set src1=%src%pe echo. echo 正在把启动文件写入ntfs区,请稍候…… pa\partassist.exe /hd:%numd% /whide:1 /src:%src1% echo. echo 正在建立数据区镜像文件夹 md %letp%:\BOOT md %letp%:\BOOT\FONTS md %letp%:\BOOT\ZH-CN md %letp%:\efi md %letp%:\efi\boot md %letp%:\efi\boot\ZH-CN md %letp%:\efi\fonts md %letp%:\efi\MICROSOFT\BOOT md %letp%:\efi\MICROSOFT\BOOT\ZH-CN md %letp%:\efi\tools md %letp%:\grub md %letp%:\grub\distro md %letp%:\grub\fonts md %letp%:\grub\i386-pc md %letp%:\grub\themes\ventoy md %letp%:\grub\x86_64-efi md %letp%:\tool md %letp%:\ventoy md %letp%:\ventoy\7z\32 md %letp%:\ventoy\7z\64 md %letp%:\ventoy\imdisk\32 md %letp%:\ventoy\imdisk\64 md %letp%:\ZH-CN md %letp%:\BOOTMGR md %letp%:\vtldr copy BOOT %letp%:\BOOT copy BOOT\FONTS %letp%:\BOOT\FONTS copy BOOT\ZH-CN %letp%:\BOOT\ZH-CN copy efi %letp%:\efi copy efi\boot %letp%:\efi\boot copy efi\boot\ZH-CN %letp%:\efi\boot\ZH-CN copy efi\fonts %letp%:\efi\fonts copy efi\MICROSOFT\BOOT %letp%:\efi\MICROSOFT\BOOT copy efi\MICROSOFT\BOOT\ZH-CN %letp%:\efi\MICROSOFT\BOOT\ZH-CN copy efi\tools %letp%:\efi\tools copy grub %letp%:\grub copy grub\distro %letp%:\grub\distro copy grub\fonts %letp%:\grub\fonts copy grub\i386-pc %letp%:\grub\i386-pc copy grub\themes\ventoy %letp%:\grub\themes\ventoy copy grub\x86_64-efi %letp%:\grub\x86_64-efi copy tool %letp%:\tool copy ventoy %letp%:\ventoy copy ventoy\7z\32 %letp%:\ventoy\7z\32 copy ventoy\7z\64 %letp%:\ventoy\7z\64 copy ventoy\imdisk\32 %letp%:\ventoy\imdisk\32 copy ventoy\imdisk\64 %letp%:\ventoy\imdisk\64 copy ZH-CN %letp%:\ZH-CN copy BOOTMGR %letp%:\BOOTMGR copy vtldr %letp%:\vtldr echo. echo UEFI启动U盘制作完成! pause |
|