w10install/image/export-image.cmd

52 lines
944 B
Batchfile
Raw Permalink Normal View History

2021-01-10 15:49:37 +01:00
@echo off
2023-02-20 07:56:50 +01:00
set SOURCES=%SystemDrive%\TEMP\W10\sources
2021-03-28 00:10:18 +01:00
set WIM=%SOURCES%\install.wim
2021-03-28 00:29:33 +01:00
set W10PRO=%SOURCES%\w10pro.wim
set STATEFILE=%SOURCES%\w10pro.txt
2021-03-28 00:45:34 +01:00
if EXIST %STATEFILE% (
echo.
2021-03-28 11:54:06 +02:00
echo [%0] INFO: found %STATEFILE%
echo [%0] OK: nothing todo. all work was already done.
2021-03-28 00:45:34 +01:00
echo READY.
exit /b
)
2021-03-28 00:29:33 +01:00
if EXIST %WIM% (
2021-03-28 00:41:45 +01:00
rem cleanup ...
del /F %W10PRO% 1>nul 2>nul
2021-03-28 00:29:33 +01:00
echo.
2021-03-28 11:54:06 +02:00
echo [%0] INFO: found %WIM%
2021-03-28 00:29:33 +01:00
2021-03-28 11:54:06 +02:00
echo [%0] INFO: exporting image from %WIM% ...
2021-03-28 00:29:33 +01:00
dism /Export-Image ^
/SourceImageFile:%WIM% ^
/DestinationImageFile:%W10PRO% ^
/SourceName:"Windows 10 Pro" ^
2021-03-28 00:32:53 +01:00
/Compress:Max ^
2021-03-28 00:29:33 +01:00
/CheckIntegrity
2021-03-28 11:54:06 +02:00
if %ERRORLEVEL% NEQ 0 (
echo [%0] ERROR: while extracting %WIM%
exit /b
)
2021-03-28 00:51:45 +01:00
2021-03-28 11:54:06 +02:00
echo [%0] WARNING: removing original %WIM% ...
attrib -R %WIM% 2>nul
del /F %WIM% 1>nul 2>nul
echo [%0] INFO: renaming %W10PRO% ...
2021-03-28 00:29:33 +01:00
move /Y %W10PRO% %WIM%
echo all done >%STATEFILE%
2021-01-10 15:49:37 +01:00
echo.
2021-03-28 00:29:33 +01:00
echo READY.
exit /b
)