2017-11-22 08:40:21 +08:00
|
|
|
|
@echo off
|
|
|
|
|
|
|
|
|
|
rem <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ԱȨ<D4B1><C8A8>
|
|
|
|
|
pushd "%~dp0" && Dism 1>nul 2>nul || mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 "%*"","","runas",1)(window.close) && Exit /B 1
|
|
|
|
|
rem <20><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD>
|
|
|
|
|
color 1F
|
|
|
|
|
mode con cols=120
|
2017-11-27 10:27:20 +08:00
|
|
|
|
set "Dism=Dism.exe /NoRestart /LogLevel:1"
|
2017-11-22 08:40:21 +08:00
|
|
|
|
set "ESDPath=%~1"
|
|
|
|
|
|
|
|
|
|
if "%ESDPath%" equ "" call :SelectFolder
|
2018-12-28 10:09:18 +08:00
|
|
|
|
if "%ESDPath%" equ "" goto :Exit
|
2017-11-22 08:40:21 +08:00
|
|
|
|
rem call :ExportISO "E G", "%~dp0install.wim"
|
2021-05-20 10:15:56 +08:00
|
|
|
|
for %%i in (X64) do call :Export21H1 "%ESDPath%", "%~dp0DVD_%%i", "%%i"
|
2017-11-22 08:40:21 +08:00
|
|
|
|
goto :Exit
|
|
|
|
|
|
|
|
|
|
:SelectFolder
|
|
|
|
|
set folder=mshta "javascript:var folder=new ActiveXObject('Shell.Application').BrowseForFolder(0,'ѡ<><D1A1>ESD<53><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼', 513, '');if(folder) new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).Write(folder.Self.Path);window.close();"
|
|
|
|
|
for /f %%f in ('%folder%') do set "ESDPath=%%f"
|
|
|
|
|
goto :eof
|
|
|
|
|
|
|
|
|
|
rem <20><><EFBFBD><EFBFBD>ISO<53><4F><EFBFBD><EFBFBD> [ %~1 : <20>̷<EFBFBD><CCB7>б<EFBFBD>[<5B>ո<EFBFBD><D5B8>ָ<EFBFBD>], %~2 : Ŀ<><C4BF>·<EFBFBD><C2B7> ]
|
|
|
|
|
:ExportISO
|
2017-11-27 10:27:20 +08:00
|
|
|
|
call :RemoveFile "%~2"
|
2017-11-22 08:40:21 +08:00
|
|
|
|
for %%i in (%~1) do call :ExportImage "%%i:\sources\install.wim", "%~2"
|
|
|
|
|
goto :eof
|
|
|
|
|
|
2021-05-20 10:15:56 +08:00
|
|
|
|
rem <20><><EFBFBD><EFBFBD>21H1<48><31><EFBFBD><EFBFBD> [ %~1 : Դ·<D4B4><C2B7>, %~2 : Ŀ<><C4BF>·<EFBFBD><C2B7>, %~3 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܹ<EFBFBD> ]
|
|
|
|
|
:Export21H1
|
2017-11-22 08:40:21 +08:00
|
|
|
|
if not exist "%~1" echo [%~1] <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> && goto :eof
|
2022-09-29 13:54:20 +08:00
|
|
|
|
set "WimPath=%~dp0install_22H2_%~3_%date:~0,4%%date:~5,2%%date:~8,2%.wim"
|
2017-11-27 10:27:20 +08:00
|
|
|
|
call :RemoveFile "%WimPath%"
|
|
|
|
|
call :RemoveFolder "%~2"
|
2017-11-22 08:40:21 +08:00
|
|
|
|
rem <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>
|
2018-10-26 14:42:02 +08:00
|
|
|
|
for %%i in (china consumer business) do (
|
2022-09-29 13:54:20 +08:00
|
|
|
|
for %%j in ("%~1\*.ni_release_*%%i*_%~3fre_*.esd") do (
|
2018-04-27 09:57:32 +08:00
|
|
|
|
if not exist "%~2" call :ExportDVD "%%j", "%~2"
|
2018-04-11 10:22:45 +08:00
|
|
|
|
call :ExportImage "%%j", "%WimPath%"
|
|
|
|
|
)
|
|
|
|
|
)
|
2018-10-15 23:27:36 +08:00
|
|
|
|
call :MakeISO "%WimPath%", "%~2"
|
2018-04-11 10:22:45 +08:00
|
|
|
|
goto :eof
|
|
|
|
|
|
2017-11-27 10:27:20 +08:00
|
|
|
|
rem <20><><EFBFBD><EFBFBD>ISO [ %~1 : Դ·<D4B4><C2B7>, %~2 : Ŀ<><C4BF>·<EFBFBD><C2B7> ]
|
|
|
|
|
:MakeISO
|
|
|
|
|
call "%~dp0WimHelper.cmd" "%~1"
|
|
|
|
|
rem ת<><D7AA>ESD<53><44><EFBFBD><EFBFBD>
|
|
|
|
|
%Dism% /Export-Image /SourceImageFile:"%~1" /All /DestinationImageFile:"%~2\sources\install.esd" /Compress:recovery
|
|
|
|
|
rem <20><><EFBFBD><EFBFBD>ISO<53><4F><EFBFBD><EFBFBD>
|
|
|
|
|
for /f "tokens=3" %%f in ('%Dism% /English /Get-ImageInfo /ImageFile:"%~1" /Index:1 ^| findstr /i Architecture') do ( set "ImageArch=%%f" )
|
|
|
|
|
for /f "tokens=3 delims=." %%f in ('%Dism% /English /Get-ImageInfo /ImageFile:"%~1" /Index:1 ^| findstr /i Version') do ( set "ImageRevision=%%f" )
|
2019-04-15 17:13:25 +08:00
|
|
|
|
for /f "tokens=4" %%f in ('%Dism% /English /Get-ImageInfo /ImageFile:"%~1" /Index:1 ^| find "ServicePack Build"') do ( set "ImageBuild=%%f" )
|
2017-11-27 10:27:20 +08:00
|
|
|
|
for /f "tokens=* delims=" %%f in ('Dism.exe /English /Get-ImageInfo /ImageFile:"%~1" /Index:1 ^| findstr /i Default') do ( set "ImageLanguage=%%f" )
|
|
|
|
|
call "%~dp0MakeISO.cmd" "%~2" "Win10_%ImageRevision%.%ImageBuild%_%ImageArch%_%ImageLanguage:~1,-10%"
|
2017-11-29 13:43:09 +08:00
|
|
|
|
rem <20><><EFBFBD>ɶ<EFBFBD><C9B6><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
|
|
|
|
|
set "ESDPath=%~dp0cn_windows_10_%ImageRevision%.%ImageBuild%_x86_x64.esd"
|
|
|
|
|
if exist "%ESDPath%" (
|
|
|
|
|
%Dism% /Export-Image /SourceImageFile:"%~1" /All /DestinationImageFile:"%ESDPath%" /Compress:recovery
|
|
|
|
|
) else (
|
|
|
|
|
move "%~2\sources\install.esd" "%ESDPath%" >nul
|
|
|
|
|
)
|
|
|
|
|
call :RemoveFile "%~1"
|
2017-11-27 10:27:20 +08:00
|
|
|
|
call :RemoveFolder "%~2"
|
2017-11-22 08:40:21 +08:00
|
|
|
|
goto :eof
|
|
|
|
|
|
|
|
|
|
rem <20><><EFBFBD><EFBFBD>DVD<56><44><EFBFBD><EFBFBD>Ŀ¼ [ %~1 : Դ·<D4B4><C2B7>, %~2 : Ŀ<><C4BF>·<EFBFBD><C2B7> ]
|
|
|
|
|
:ExportDVD
|
|
|
|
|
md "%~2"
|
2017-11-27 10:27:20 +08:00
|
|
|
|
%Dism% /Apply-Image /ImageFile:"%~1" /Index:1 /ApplyDir:"%~2"
|
2017-11-22 08:40:21 +08:00
|
|
|
|
rem <20><>ȡ<EFBFBD>汾<EFBFBD><E6B1BE>Ϣ
|
2017-11-27 10:27:20 +08:00
|
|
|
|
for /f "tokens=3" %%f in ('%Dism% /English /Get-ImageInfo /ImageFile:"%~1" /Index:3 ^| findstr /i Version') do ( set "ImageVersion=%%f" )
|
|
|
|
|
for /f "tokens=3" %%f in ('%Dism% /English /Get-ImageInfo /ImageFile:"%~1" /Index:3 ^| findstr /i Architecture') do ( set "ImageArch=%%f" )
|
|
|
|
|
set "NetFx3Path=%~dp0Pack\NetFx3\%ImageVersion%.%ImageArch%"
|
2018-11-14 10:30:13 +08:00
|
|
|
|
rem if not exist "%NetFx3Path%" xcopy /I /H /R /Y "%~2\sources\sxs" "%NetFx3Path%" >nul
|
2017-11-22 08:40:21 +08:00
|
|
|
|
rem <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
del /q "%~2\autorun.inf"
|
|
|
|
|
rd /s /q "%~2\support"
|
|
|
|
|
rd /s /q "%~2\boot\zh-cn"
|
2018-10-15 23:27:36 +08:00
|
|
|
|
rd /s /q "%~2\sources\sxs"
|
2017-11-22 08:40:21 +08:00
|
|
|
|
for /f "tokens=* delims=" %%f in ('dir /a:-d /b "%~2\boot" ^| findstr /v "bcd boot.sdi etfsboot.com"') do del /q "%~2\boot\%%f"
|
|
|
|
|
for /f "tokens=* delims=" %%f in ('dir /a:-d /b "%~2\boot\fonts" ^| findstr /v "chs wgl4"') do del /q "%~2\boot\fonts\%%f"
|
|
|
|
|
for /f "tokens=* delims=" %%f in ('dir /a:-d /b "%~2\efi\microsoft\boot" ^| findstr /v "bcd efisys.bin"') do del /q "%~2\efi\microsoft\boot\%%f"
|
|
|
|
|
for /f "tokens=* delims=" %%f in ('dir /a:-d /b "%~2\efi\microsoft\boot\fonts" ^| findstr /v "chs wgl4"') do del /q "%~2\efi\microsoft\boot\fonts\%%f"
|
|
|
|
|
rem <20><><EFBFBD><EFBFBD>WinPE
|
2017-11-27 10:27:20 +08:00
|
|
|
|
%Dism% /Export-Image /SourceImageFile:"%~1" /SourceIndex:3 /DestinationImageFile:"%~2\sources\boot.wim" /Bootable /Compress:max
|
2017-11-22 08:40:21 +08:00
|
|
|
|
goto :eof
|
|
|
|
|
|
|
|
|
|
rem ############################################################################################
|
|
|
|
|
rem <20><><EFBFBD>ߺ<EFBFBD><DFBA><EFBFBD>
|
|
|
|
|
rem ############################################################################################
|
|
|
|
|
|
|
|
|
|
rem <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> [ %~1 : <20><><EFBFBD><EFBFBD>·<EFBFBD><C2B7>, %~2 : Ŀ<><C4BF>·<EFBFBD><C2B7> ]
|
|
|
|
|
:ExportImage
|
|
|
|
|
if not exist "%~1" ( echo.<2E><><EFBFBD><EFBFBD> %~1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> && goto :eof )
|
2017-11-27 10:27:20 +08:00
|
|
|
|
for /f "tokens=2 delims=: " %%f in ('%Dism% /English /Get-ImageInfo /ImageFile:"%~1" ^| findstr /i Index') do ( call :ExportImageIndex "%~1", %%f, "%~2" )
|
2017-11-22 08:40:21 +08:00
|
|
|
|
goto :eof
|
|
|
|
|
|
|
|
|
|
rem <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> [ %~1 : <20><><EFBFBD><EFBFBD>·<EFBFBD><C2B7>, %~2 : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, %~3 : Ŀ<><C4BF>·<EFBFBD><C2B7> ]
|
|
|
|
|
:ExportImageIndex
|
|
|
|
|
rem <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
2017-11-27 10:27:20 +08:00
|
|
|
|
for /f "tokens=3" %%f in ('%Dism% /English /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Installation') do ( set "ImageType=%%f" )
|
|
|
|
|
for /f "tokens=2,3 delims=:. " %%f in ('%Dism% /English /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Version') do ( set "ImageShortVersion=%%f.%%g" )
|
2017-11-22 08:40:21 +08:00
|
|
|
|
rem ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>
|
|
|
|
|
if "%ImageType%" equ "Client" (
|
2017-11-27 10:27:20 +08:00
|
|
|
|
if "%ImageShortVersion%" equ "6.1" ( set "ImageName=Windows 7" )
|
|
|
|
|
if "%ImageShortVersion%" equ "6.2" ( set "ImageName=Windows 8" )
|
|
|
|
|
if "%ImageShortVersion%" equ "6.3" ( set "ImageName=Windows 8.1" )
|
|
|
|
|
if "%ImageShortVersion%" equ "10.0" ( set "ImageName=Windows 10" )
|
2017-11-22 08:40:21 +08:00
|
|
|
|
) else if "%ImageType%" equ "Server" (
|
2017-11-27 10:27:20 +08:00
|
|
|
|
if "%ImageShortVersion%" equ "6.1" ( set "ImageName=Windows 2008 R2" )
|
|
|
|
|
if "%ImageShortVersion%" equ "6.2" ( set "ImageName=Windows 2012" )
|
|
|
|
|
if "%ImageShortVersion%" equ "6.3" ( set "ImageName=Windows 2012 R2" )
|
|
|
|
|
if "%ImageShortVersion%" equ "10.0" ( set "ImageName=Windows 2016" )
|
2017-11-22 08:40:21 +08:00
|
|
|
|
) else ( goto :eof )
|
|
|
|
|
rem ϵͳ<CFB5>汾
|
2017-11-27 10:27:20 +08:00
|
|
|
|
for /f "tokens=3" %%f in ('%Dism% /English /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Edition') do ( set "ImageEdition=%%f" )
|
2017-11-22 08:40:21 +08:00
|
|
|
|
if "%ImageEdition%" equ "Cloud" ( goto :eof )
|
|
|
|
|
if "%ImageEdition%" equ "CoreCountrySpecific" ( set "ImageName=%ImageName% <20><>ͥ<EFBFBD><CDA5><EFBFBD>İ<EFBFBD>" )
|
2017-12-25 18:05:25 +08:00
|
|
|
|
if "%ImageEdition%" equ "CoreSingleLanguage" ( goto :eof )
|
|
|
|
|
if "%ImageEdition%" equ "Core" ( goto :eof )
|
2018-10-15 23:27:36 +08:00
|
|
|
|
if "%ImageEdition%" equ "Education" ( goto :eof )
|
2017-11-22 08:40:21 +08:00
|
|
|
|
if "%ImageEdition%" equ "Professional" ( set "ImageName=%ImageName% רҵ<D7A8><D2B5>" )
|
|
|
|
|
if "%ImageEdition%" equ "Enterprise" ( set "ImageName=%ImageName% <20><>ҵ<EFBFBD><D2B5>" )
|
2017-12-25 18:05:25 +08:00
|
|
|
|
if "%ImageEdition%" equ "EnterpriseS" ( set "ImageName=%ImageName% <20><>ҵ<EFBFBD><D2B5> 2016 <20><><EFBFBD>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD><EFBFBD>" )
|
2017-11-22 08:40:21 +08:00
|
|
|
|
if "%ImageEdition%" equ "ServerStandard" ( set "ImageName=%ImageName% <20><><EFBFBD><D7BC>" )
|
|
|
|
|
if "%ImageEdition%" equ "ServerEnterprise" ( set "ImageName=%ImageName% <20><>ҵ<EFBFBD><D2B5>" )
|
|
|
|
|
if "%ImageEdition%" equ "ServerWeb" ( set "ImageName=%ImageName% Web<65><62>" )
|
|
|
|
|
if "%ImageEdition%" equ "ServerDatacenter" ( set "ImageName=%ImageName% <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD>" )
|
|
|
|
|
rem <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܹ<EFBFBD>
|
2017-11-27 10:27:20 +08:00
|
|
|
|
rem for /f "tokens=3" %%f in ('%Dism% /English /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Architecture') do ( set "ImageArch=%%f" )
|
2017-11-22 08:40:21 +08:00
|
|
|
|
rem if "%ImageArch%" equ "x86" ( set "ImageName=%ImageName% 32λ" )
|
|
|
|
|
rem if "%ImageArch%" equ "x64" ( set "ImageName=%ImageName% 64λ" )
|
|
|
|
|
rem <20>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>
|
2017-11-27 10:27:20 +08:00
|
|
|
|
for /f "tokens=3" %%f in ('%Dism% /English /Get-ImageInfo /ImageFile:"%~3" /Name:"%ImageName%" ^| findstr /i Index') do ( echo <20><><EFBFBD><EFBFBD> %ImageName% <20>Ѵ<EFBFBD><D1B4><EFBFBD> %%f && goto :eof )
|
2017-11-22 08:40:21 +08:00
|
|
|
|
rem <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
|
|
|
|
if /i "%~x3" equ ".wim" ( set "Compress=/Compress:max" )
|
|
|
|
|
if /i "%~x3" equ ".esd" ( set "Compress=/Compress:recovery" )
|
2017-11-27 10:27:20 +08:00
|
|
|
|
%Dism% /Export-Image /SourceImageFile:"%~1" /SourceIndex:%~2 /DestinationImageFile:"%~3" /DestinationName:"%ImageName%" %Compress%
|
|
|
|
|
goto :eof
|
|
|
|
|
|
|
|
|
|
rem ɾ<><C9BE><EFBFBD>ļ<EFBFBD> [ %~1 : <20>ļ<EFBFBD>·<EFBFBD><C2B7> ]
|
|
|
|
|
:RemoveFile
|
|
|
|
|
if exist "%~1" del /f /q "%~1"
|
|
|
|
|
goto :eof
|
|
|
|
|
|
|
|
|
|
rem ɾ<><C9BE>Ŀ¼ [ %~1 : Ŀ¼·<C2BC><C2B7> ]
|
|
|
|
|
:RemoveFolder
|
|
|
|
|
if exist "%~1" rd /q /s "%~1"
|
2017-11-22 08:40:21 +08:00
|
|
|
|
goto :eof
|
|
|
|
|
|
|
|
|
|
:Exit
|
2018-10-26 14:42:02 +08:00
|
|
|
|
rem shutdown -s -t 0
|