-
Notifications
You must be signed in to change notification settings - Fork 7
/
MakeISO.cmd
47 lines (44 loc) · 1.6 KB
/
MakeISO.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
@echo off
color 1F
mode con lines=30 cols=90
rem 初始化变量
set "Oscdimg=%~sdp0Bin\%PROCESSOR_ARCHITECTURE%\oscdimg.exe"
set "DVD=%~1"
set "ISOLabel=%~2"
set "ISOFileName=%~3"
rem 选择光盘镜像目录
if "%DVD%" equ "" call :SelectFolder
set "BIOSBoot=%DVD%\boot\etfsboot.com"
set "UEFIBoot=%DVD%\efi\microsoft\boot\efisys.bin"
rem 自动生成卷标
call :MakeLabel %DVD%
if "%ISOFileName%" equ "" ( set "ISOFileName=%~dp0%ISOLabel%.iso" )
rem 生成ei.cfg
if exist "%DVD%\sources\ei.cfg" del /f /q "%DVD%\sources\ei.cfg"
if exist "%DVD%\sources" (
echo.[EditionID]
echo.
echo.[Channel]
echo.OEM
echo.[VL]
echo.1
)>"%DVD%\sources\ei.cfg"
rem 判断UEFI引导
if exist "%UEFIBoot%" (
"%Oscdimg%" -bootdata:2#p0,e,b"%BIOSBoot%"#pEF,e,b"%UEFIBoot%" -o -h -m -u2 -t%date:~5,2%/%date:~8,2%/%date:~0,4%,12:00:00 -l"%ISOLabel%" "%DVD%" "%ISOFileName%"
) else if exist "%BIOSBoot%" (
"%Oscdimg%" -bootdata:1#p0,e,b"%BIOSBoot%" -o -h -m -u2 -t%date:~5,2%/%date:~8,2%/%date:~0,4%,12:00:00 -l"%ISOLabel%" "%DVD%" "%ISOFileName%"
) else (
"%Oscdimg%" -o -h -m -u2 -t%date:~5,2%/%date:~8,2%/%date:~0,4%,12:00:00 -l"%ISOLabel%" "%DVD%" "%ISOFileName%"
)
goto :Exit
:SelectFolder
set folder=mshta "javascript:var folder=new ActiveXObject('Shell.Application').BrowseForFolder(0,'选择安装镜像所在目录', 513, '');if(folder) new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).Write(folder.Self.Path);window.close();"
for /f "tokens=* delims=" %%f in ('%folder%') do set "DVD=%%f"
if "%DVD%" equ "" goto :Exit
goto :eof
:MakeLabel
if "%ISOLabel%" equ "" ( set "ISOLabel=%~n1" )
goto :eof
:Exit
if "%~1" equ "" pause