-
Notifications
You must be signed in to change notification settings - Fork 0
/
Simple-Windows-Image-Splitter-Merger.bat
752 lines (683 loc) · 30.2 KB
/
Simple-Windows-Image-Splitter-Merger.bat
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
@ECHO off
setlocal EnableDelayedExpansion
TITLE Simple Windows Image Splitter/Merger (WIM/ESD ^<-^> SWM) - By Joel Didier (Studisys)
GOTO ADMIN_RIGHTS_ROUTINE
::==================================================================
:: HERE STARTS THIS PART - ADMIN_RIGHTS_ROUTINE
::==================================================================
:ADMIN_RIGHTS_ROUTINE
IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
>NUL 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
) ELSE (
>NUL 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
)
IF '%ERRORLEVEL%' NEQ '0' (
GOTO GET_ADMIN_RIGHTS
) ELSE ( GOTO GET_ADMIN_RIGHTS_SUCCESS )
::==================================================================
:: HERE ENDS THIS PART - ADMIN_RIGHTS_ROUTINE
::==================================================================
::==================================================================
:: HERE STARTS THIS PART - GET_ADMIN_RIGHTS
::==================================================================
:GET_ADMIN_RIGHTS
CLS
COLOR 17
ECHO.
ECHO. ================================================================
ECHO. Simple Windows Image Splitter/Merger
ECHO. Administrator Rights Required
ECHO. ================================================================
ECHO.
ECHO.
ECHO. You did not execute the script as Administrator.
ECHO. Administrator rights are required.
ECHO. You will now be prompted for Administrator rights.
ECHO. If you do not grant Administrator rights, this script will not run.
ECHO.
PAUSE
ECHO Set UAC = CreateObject^("Shell.Application"^) > "%temp%\GET_ADMIN_RIGHTS.vbs"
SET params = %*:"=""
ECHO UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params%", "", "runas", 1 >> "%temp%\GET_ADMIN_RIGHTS.vbs"
"%temp%\GET_ADMIN_RIGHTS.vbs"
DEL "%temp%\GET_ADMIN_RIGHTS.vbs"
EXIT /B
::==================================================================
:: HERE ENDS THIS PART - GET_ADMIN_RIGHTS
::==================================================================
::==================================================================
:: HERE STARTS THIS PART - GET_ADMIN_RIGHTS_SUCCESS
::==================================================================
:GET_ADMIN_RIGHTS_SUCCESS
pushd "%CD%"
CD /D "%~dp0"
GOTO Home
::==================================================================
:: HERE ENDS THIS PART - GET_ADMIN_RIGHTS_SUCCESS
::==================================================================
::==================================================================
:: HERE STARTS THIS PART - Home
::==================================================================
:Home
CLS
COLOR 17
ECHO.
ECHO. ================================================================
ECHO. Simple Windows Image Splitter/Merger
ECHO. Welcome
ECHO. ================================================================
ECHO.
ECHO.
ECHO. Welcome to the Simple Windows Image Splitter/Merger (WIM/ESD ^<-^> SWM) (version 0.5.0-beta)
ECHO.
ECHO. This tool allows to quickly split WIM/ESD Images into multiple SWM Images,
ECHO. but also merging SWM images into single WIM/ESD Images.
ECHO.
ECHO. Please read the full documentation on :
ECHO. https://github.com/Studisys/Simple-Windows-Image-Splitter-Merger/
ECHO.
ECHO.
PAUSE
GOTO PROCESSING_ROUTINE
::==================================================================
:: HERE ENDS THIS PART - Home
::==================================================================
::==================================================================
:: HERE STARTS THIS PART - PROCESSING_ROUTINE
::==================================================================
:PROCESSING_ROUTINE
:: [1] Ask for conversion type
CALL :CONVERSION_TYPE_SET
:: [2] Set the source image path
CALL :SRCPATH_SET
IF "%CONVTYPE%" == "SWM2WIM" (
CALL :GET_SWM_FILES
)
IF "%CONVTYPE%" == "SWM2ESD" (
CALL :GET_SWM_FILES
)
:: [3] Set the destination image path
CALL :DSTPATH_SET
:: Now checking Conversion Type and proceed accordingly
:: [4] If conversion to SWM, set size per SWM
IF "%CONVTYPE%" == "WIM2SWM" CALL :FILE_SIZE_SET
IF "%CONVTYPE%" == "ESD2SWM" CALL :FILE_SIZE_SET
:: [4] If conversion from SWM, set compression type
IF "%CONVTYPE%" == "SWM2WIM" CALL :COMPRESSIONTYPE_SET
IF "%CONVTYPE%" == "SWM2ESD" CALL :COMPRESSIONTYPE_SET
:: [5] Select indexes to export
GOTO INDEX_SELECTION
GOTO EXIT
::==================================================================
:: HERE ENDS THIS PART - ProcessingRoutine
::==================================================================
::==================================================================
:: HERE STARTS THIS PART - FILE_SIZE_SET
::==================================================================
:FILE_SIZE_SET
CLS
ECHO.
ECHO. ================================================================
ECHO. Simple Windows Image Splitter/Merger
ECHO. Program Parameters
ECHO. Filesize per SWM Image
ECHO. ================================================================
ECHO.
ECHO. Please choose the maximum size per SWM Image in MB, without quotes nor unit.
ECHO. Please note that the maximum size per SWM Image is 4700MB.
ECHO.
ECHO. Example : The input "700" (without quotes) will make SWM Images with a maximum size of 700MB each.
ECHO.
SET /P SWMSize= Size (in MB) :
GOTO :eof
::==================================================================
:: HERE ENDS THIS PART - FILE_SIZE_SET
::==================================================================
::==================================================================
:: HERE STARTS THIS PART - CONPRESSION_TYPE_SET
::==================================================================
:COMPRESSIONTYPE_SET
CLS
ECHO.
ECHO. ================================================================
ECHO. Simple Windows Image Splitter/Merger
ECHO. Program Parameters
ECHO. Compression Type
ECHO. ================================================================
ECHO.
ECHO. Please enter the compression type.
ECHO.
ECHO. Available Compression Types :
ECHO.
ECHO. [1] None : No Compression (Fastest) [Destination Image bigger than Source Image]
ECHO.
ECHO. [2] Fast : Low Compression (Fast) [Destination Image 'may' be bigger than Source Image]
ECHO.
ECHO. [3] Maximum : Very High Compression (Slow) [Destination Image WAY smaller than Source Image]
ECHO.
ECHO. [4] Recovery : Insane Compression (Slowest) [Destination Image WAY smaller than Source Image]
ECHO.
ECHO.
ECHO. ================================================================
ECHO. Press 'Q' to exit, 'S' to start over
ECHO. ================================================================
ECHO.
CHOICE /c 1234qs /n /m "Your choice : "
IF %ERRORLEVEL%==1 (
SET COMPRESSIONTYPE=None
)
IF %ERRORLEVEL%==2 (
SET COMPRESSIONTYPE=Fast
)
IF %ERRORLEVEL%==3 (
SET COMPRESSIONTYPE=Maximum
)
IF %ERRORLEVEL%==4 (
SET COMPRESSIONTYPE=Recovery
)
IF %ERRORLEVEL%==5 EXIT
IF %ERRORLEVEL%==6 GOTO ADMIN_RIGHTS_ROUTINE
GOTO :eof
::==================================================================
:: HERE ENDS THIS PART - CONPRESSION_TYPE_SET
::==================================================================
::==================================================================
:: HERE STARTS THIS PART - CONVERSION_TYPE_SET
::==================================================================
:CONVERSION_TYPE_SET
CLS
ECHO.
ECHO. ================================================================
ECHO. Simple Windows Image Splitter/Merger
ECHO. Program Parameters
ECHO. Conversion Type
ECHO. ================================================================
ECHO.
ECHO.
ECHO. What type of conversion do you want ?
ECHO.
ECHO. [1] WIM --^> SWM
ECHO. [2] ESD --^> SWM
ECHO. ------------------
ECHO. [3] SWM --^> WIM
ECHO. [4] SWM --^> ESD
ECHO.
ECHO.
ECHO. ================================================================
ECHO. Press 'Q' to exit, 'S' to start over
ECHO. ================================================================
ECHO.
CHOICE /c 1234qs /n /m " Your choice : "
IF %ERRORLEVEL%==1 (
SET SRCtype=WIM
SET DSTtype=SWM
SET CONVTYPE=WIM2SWM
SET SRCPATH=install.wim
SET DSTPATH=install.swm
SET COMPRESSIONTYPE=Recovery
GOTO :eof
)
IF %ERRORLEVEL%==2 (
SET SRCtype=ESD
SET DSTtype=SWM
SET CONVTYPE=ESD2SWM
SET SRCPATH=install.esd
SET DSTPATH=install.swm
SET COMPRESSIONTYPE=Recovery
GOTO :eof
)
IF %ERRORLEVEL%==3 (
SET SRCtype=SWM
SET DSTtype=WIM
SET CONVTYPE=SWM2WIM
SET SRCPATH=install.swm
SET DSTPATH=install.wim
SET COMPRESSIONTYPE=Recovery
GOTO :eof
)
IF %ERRORLEVEL%==4 (
SET SRCtype=SWM
SET DSTtype=ESD
SET CONVTYPE=SWM2ESD
SET SRCPATH=install.swm
SET DSTPATH=install.esd
SET COMPRESSIONTYPE=Recovery
GOTO :eof
)
IF %ERRORLEVEL%==5 EXIT
IF %ERRORLEVEL%==6 GOTO ADMIN_RIGHTS_ROUTINE
GOTO :eof
::==================================================================
:: HERE ENDS THIS PART - CONVERSION_TYPE_SET
::==================================================================
::==================================================================
:: HERE STARTS THIS PART - SRCPATH_SET
::==================================================================
:SRCPATH_SET
CLS
ECHO.
ECHO. ================================================================
ECHO. Simple Windows Image Splitter/Merger
ECHO. %SRCtype% --^> %DSTtype%
ECHO. Path to Source Image
ECHO. ================================================================
ECHO.
ECHO.
ECHO. Please enter the path to the source image.
ECHO. (Do not include quotes "")
ECHO.
SET /P c= Path :
SET SRCPATH=%c%
GOTO :eof
::==================================================================
:: HERE ENDS THIS PART - SRCPATH_SET
::==================================================================
::==================================================================
:: HERE STARTS THIS PART - DSTPATH_SET
::==================================================================
:DSTPATH_SET
CLS
ECHO.
ECHO. ================================================================
ECHO. Simple Windows Image Splitter/Merger
ECHO. %SRCtype% --^> %DSTtype%
ECHO. Path to Destination Image
ECHO. ================================================================
ECHO.
ECHO.
ECHO. Please enter the path to the destination image.
ECHO. (Do not include quotes "")
ECHO.
SET /P c= Path :
SET DSTPATH=%c%
GOTO :eof
::==================================================================
:: HERE ENDS THIS PART - DSTPATH_SET
::==================================================================
::==================================================================
:: HERE STARTS THIS PART - INDEX_SELECTION
::==================================================================
:INDEX_SELECTION
CLS
ECHO. ================================================================
ECHO. Simple Windows Image Splitter/Merger
ECHO. %SRCtype% --^> %DSTtype%
ECHO. Index Selection
ECHO. ================================================================
ECHO.
setlocal EnableDelayedExpansion
SET /A count=0
FOR /F "tokens=2 delims=: " %%i IN ('DISM /Get-WimInfo /WimFile:"%SRCPATH%" ^| findstr "Index"') DO SET images=%%i
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
FOR /L %%i in (1, 1, %images%) DO CALL :INDEXCOUNTER %%i
ECHO. The %SRCtype% Image contains the following %images% indexes :
ECHO.
FOR /L %%i in (1, 1, %images%) DO (
ECHO. [%%i] !name%%i!
)
ECHO.
ECHO. ================================================================
ECHO.
ECHO. What do you want to do ?
ECHO.
ECHO. [1] Export a single Index
ECHO. [2] Export all Indexes
ECHO. ================================================================
ECHO. Press 'Q' to exit, 'S' to start over
ECHO. ================================================================
ECHO.
CHOICE /c 12qs /n /m "Your choice : "
IF %ERRORLEVEL%==1 (
SET CONVERSION_TYPE=SINGLE_INDEX
ECHO.
SET /P INDEXCHOICE= Please enter the Index you want to export :
GOTO PROCESSING_CONVERT
)
IF %ERRORLEVEL%==2 (
SET CONVERSION_TYPE=ALL_INDEXES
GOTO PROCESSING_CONVERT
)
IF %ERRORLEVEL%==3 EXIT
IF %ERRORLEVEL%==4 GOTO ADMIN_RIGHTS_ROUTINE
GOTO EXIT
::==================================================================
:: HERE ENDS THIS PART - INDEX_SELECTION
::==================================================================
:INDEXCOUNTER
SET /A count+=1
FOR /f "tokens=1* delims=: " %%i IN ('DISM /Get-WimInfo /wimfile:"%SRCPATH%" /index:%1 ^| find /i "Name"') DO SET name%count%=%%j
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
GOTO :eof
:DEL_DSTPATH
IF EXIST %DSTPATH% (
DEL /F %DSTPATH%
)
GOTO :eof
:GET_SWM_FILES
CLS
TITLE
ECHO.
ECHO. ================================================================
ECHO. Simple Windows Image Splitter/Merger
ECHO. %SRCtype% --^> %DSTtype%
ECHO. SWM Pattern
ECHO. ================================================================
ECHO.
ECHO.
ECHO. Please enter the SWM Pattern.
ECHO. Example : if the source SWM file was : "C:\Path\To\install.swm" , type :
ECHO. "C:\Path\To\install*.swm" (without quotes)
ECHO.
ECHO. (Do not include quotes "")
ECHO.
SET /P c= Path (Pattern) :
SET SWMFILE=%c%
GOTO :eof
:PROCESSING_CONVERT
IF "%CONVERSION_TYPE%" == "SINGLE_INDEX" (
IF "%CONVTYPE%" == "WIM2SWM" GOTO CONV2SWM_SINGLE_INDEX
IF "%CONVTYPE%" == "ESD2SWM" GOTO CONV2SWM_SINGLE_INDEX
IF "%CONVTYPE%" == "SWM2WIM" GOTO CONVFRMSWM_SINGLE_INDEX
IF "%CONVTYPE%" == "SWM2ESD" GOTO CONVFRMSWM_SINGLE_INDEX
)
IF "%CONVERSION_TYPE%" == "ALL_INDEXES" (
IF "%CONVTYPE%" == "WIM2SWM" GOTO CONV2SWM_ALL_INDEXES
IF "%CONVTYPE%" == "ESD2SWM" GOTO CONV2SWM_ALL_INDEXES
IF "%CONVTYPE%" == "SWM2WIM" GOTO CONVFRMSWM_ALL_INDEXES
IF "%CONVTYPE%" == "SWM2ESD" GOTO CONVFRMSWM_ALL_INDEXES
)
GOTO :EOF
::==================================================================
:: HERE STARTS THIS PART - CONV2SWM_ALL_INDEXES
::==================================================================
:CONV2SWM_ALL_INDEXES
CLS
CALL :DEL_DSTPATH
TITLE Simple Windows Image Splitter/Merger - %SRCtype%2%DSTtype% - Exporting Index 1 / %images% . . .
ECHO. ================================================================
ECHO. Simple Windows Image Splitter/Merger
ECHO. %SRCtype% --^> %DSTtype%
ECHO. Splitting Image - All Indexes
ECHO. Exporting Index 1 of %images% . . .
ECHO. ================================================================
ECHO.
ECHO. This will export all indexes to the destination %DSTtype% Images.
ECHO.
ECHO. PLEASE NOTE :
ECHO. This operation may take a few minutes to complete depending on your PC Hardware.
ECHO. This operation will use a lot of CPU and Memory ressources.
ECHO. Your system may be hotter or may seem unresponsive while processing your request.
ECHO. Please do not interfer with the process before it has ended.
ECHO.
ECHO. Operation : %SRCtype% to %DSTtype%
ECHO. Output : %DSTtype% Image / All Indexes (%images%)
ECHO. Source Path : %SRCPATH%
ECHO. Destination Path : %DSTPATH%
ECHO. Compression Type : %COMPRESSIONTYPE%
ECHO. Size per SWM Image : %SWMSize% MB
ECHO.
ECHO. ================================================================
ECHO.
ECHO. EXPORTING INDEX 1 OF %images%
ECHO.
ECHO. PLEASE WAIT . . .
DISM /Split-Image /ImageFile:"%SRCPATH%" /SWMFile:"%DSTPATH%" /SourceIndex:1 /FileSize:%SWMSize% /Compress:%COMPRESSIONTYPE% /CheckIntegrity> NUL 2>&1
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
FOR /L %%i IN (2, 1, %images%) DO (
CLS
TITLE Simple Windows Image Splitter/Merger - %SRCtype%2%DSTtype% - Exporting Index %%i / %images% . . .
ECHO. ================================================================
ECHO. Simple Windows Image Splitter/Merger
ECHO. %SRCtype% --^> %DSTtype%
ECHO. Splitting Image - All Indexes
ECHO. Exporting Index %%i of %images% . . .
ECHO. ================================================================
ECHO.
ECHO. This will export all indexes to the destination %DSTtype% Image.
ECHO.
ECHO. PLEASE NOTE :
ECHO. This operation may take a few minutes to complete depending on your PC Hardware.
ECHO. This operation will use a lot of CPU and Memory ressources.
ECHO. Your system may be hotter or may seem unresponsive while processing your request.
ECHO. Please do not interfer with the process before it has ended.
ECHO.
ECHO.
ECHO. Operation : %SRCtype% to %DSTtype%
ECHO. Output : %DSTtype% Image / All Indexes
ECHO. Source Path : %SRCPATH%
ECHO. Destination Path : %DSTPATH%
ECHO. Compression Type : %COMPRESSIONTYPE%
ECHO. Max Size per SWM Image : %SWMSize% MB
ECHO.
ECHO. ================================================================
ECHO.
ECHO. EXPORTING INDEX %%i OF %images%
ECHO.
ECHO. PLEASE WAIT . . .
DISM /Split-Image /ImageFile:"%SRCPATH%" /SWMFile:"%DSTPATH%" /SourceIndex:%%i /FileSize:%SWMSize% /Compress:%COMPRESSIONTYPE% /CheckIntegrity> NUL 2>&1
)
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
GOTO SUCCESS
::==================================================================
:: HERE ENDS THIS PART - CONV2SWM_ALL_INDEXES
::==================================================================
::==================================================================
:: HERE STARTS THIS PART - CONV2SWM_SINGLE_INDEX
::==================================================================
:CONV2SWM_SINGLE_INDEX
CLS
CALL :DEL_DSTPATH
TITLE Simple Windows Image Splitter/Merger - %SRCtype%2%DSTtype% - Exporting Index %INDEXCHOICE% . . .
ECHO. ================================================================
ECHO. Simple Windows Image Splitter/Merger
ECHO. %SRCtype% --^> %DSTtype%
ECHO. Merging Image - Single Index
ECHO. Exporting Index %INDEXCHOICE% . . .
ECHO. ================================================================
ECHO.
ECHO. This will export all indexes to the destination %DSTtype% Images.
ECHO.
ECHO. PLEASE NOTE :
ECHO. This operation may take a few minutes to complete depending on your PC Hardware.
ECHO. This operation will use a lot of CPU and Memory ressources.
ECHO. Your system may be hotter or may seem unresponsive while processing your request.
ECHO. Please do not interfer with the process before it has ended.
ECHO.
ECHO. Operation : %SRCtype% -^> %DSTtype%
ECHO. Output : %DSTtype% Image (Single Index - Index %INDEXCHOICE%)
ECHO. Source Path : %SRCPATH%
ECHO. Destination Path : %DSTPATH%
ECHO. Compression Type : %COMPRESSIONTYPE%
ECHO. Size per SWM Image : %SWMSize% MB
ECHO.
ECHO. ================================================================
ECHO.
ECHO. EXPORTING INDEX %INDEXCHOICE%
ECHO.
ECHO. PLEASE WAIT . . .
DISM /Split-Image /ImageFile:"%SRCPATH%" /SWMFile:%DSTPATH% /SourceIndex:%INDEXCHOICE% /FileSize:%SWMSize% /Compress:%COMPRESSIONTYPE% /CheckIntegrity> NUL 2>&1
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
GOTO SUCCESS
::==================================================================
:: HERE ENDS THIS PART - CONV2SWM_SINGLE_INDEX
::==================================================================
::==================================================================
:: HERE STARTS THIS PART - CONVFRMSWM_SINGLE_INDEX
::==================================================================
:CONVFRMSWM_SINGLE_INDEX
CLS
CALL :DEL_DSTPATH
TITLE Simple Windows Image Splitter/Merger - %SRCtype%2%DSTtype% - Exporting Index %INDEXCHOICE% . . .
ECHO. ================================================================
ECHO. Simple Windows Image Splitter/Merger
ECHO. %SRCtype% --^> %DSTtype%
ECHO. Merging Image - Single Index
ECHO. Exporting Index %INDEXCHOICE% . . .
ECHO. ================================================================
ECHO.
ECHO. This will export all indexes to the destination %DSTtype% Image.
ECHO.
ECHO. PLEASE NOTE :
ECHO. This operation may take a few minutes to complete depending on your PC Hardware.
ECHO. This operation will use a lot of CPU and Memory ressources.
ECHO. Your system may be hotter or may seem unresponsive while processing your request.
ECHO. Please do not interfer with the process before it has ended.
ECHO.
ECHO. Operation : %SRCtype% -^> %DSTtype%
ECHO. Output : %DSTtype% Image (Single Index - Index %INDEXCHOICE%)
ECHO. Source Path : %SRCPATH%
ECHO. Pattern : %SWMFILE%
ECHO. Destination Path : %DSTPATH%
ECHO. Compression Type : %COMPRESSIONTYPE%
ECHO.
ECHO. ================================================================
ECHO.
ECHO. EXPORTING INDEX %INDEXCHOICE%
ECHO.
ECHO. PLEASE WAIT . . .
DISM /Export-Image /sourceimagefile:"%SRCPATH%" /SourceIndex:%INDEXCHOICE% /swmfile:"%SWMFILE%" /destinationimagefile:"%DSTPATH%" /Compress:%COMPRESSIONTYPE% /CheckIntegrity >NUL 2>&1
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
GOTO SUCCESS
::==================================================================
:: HERE ENDS THIS PART - CONVFRMSWM_SINGLE_INDEX
::==================================================================
::==================================================================
:: HERE STARTS THIS PART - CONVFRMSWM_ALL_INDEXES
::==================================================================
:CONVFRMSWM_ALL_INDEXES
CLS
CALL :DEL_DSTPATH
TITLE Simple Windows Image Splitter/Merger - %SRCtype%2%DSTtype% - Exporting Index 1 / %images% . . .
ECHO. ================================================================
ECHO. Simple Windows Image Splitter/Merger
ECHO. %SRCtype% --^> %DSTtype%
ECHO. Merging Image - All Indexes
ECHO. Exporting Index 1 of %images% . . .
ECHO. ================================================================
ECHO.
ECHO. This will export all indexes to the destination %DSTtype% Image.
ECHO.
ECHO. PLEASE NOTE :
ECHO. This operation may take a few minutes to complete depending on your PC Hardware.
ECHO. This operation will use a lot of CPU and Memory ressources.
ECHO. Your system may be hotter or may seem unresponsive while processing your request.
ECHO. Please do not interfer with the process before it has ended.
ECHO.
ECHO. Operation : %SRCtype% -^> %DSTtype%
ECHO. Output : %DSTtype% Image - All Indexes
ECHO. Source Path : %SRCPATH%
ECHO. Pattern : %SWMFILE%
ECHO. Destination Path : %DSTPATH%
ECHO. Compression Type : %COMPRESSIONTYPE%
ECHO.
ECHO. ================================================================
ECHO.
ECHO. EXPORTING INDEX 1 OF %images%
ECHO.
ECHO. PLEASE WAIT . . .
DISM /Export-Image /sourceimagefile:"%SRCPATH%" /SourceIndex:1 /swmfile:"%SWMFILE%" /destinationimagefile:"%DSTPATH%" /Compress:%COMPRESSIONTYPE% /CheckIntegrity >NUL 2>&1
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
FOR /L %%i IN (2, 1, %images%) DO (
CLS
TITLE Simple Windows Image Splitter/Merger - %SRCtype%2%DSTtype% - Exporting Index %%i / %images% . . .
ECHO. ================================================================
ECHO. Simple Windows Image Splitter/Merger
ECHO. %SRCtype% --^> %DSTtype%
ECHO. Splitting Image - All Indexes
ECHO. Exporting Index %%i of %images% . . .
ECHO. ================================================================
ECHO.
ECHO. This will export all indexes to the destination %DSTtype% Image.
ECHO.
ECHO. PLEASE NOTE :
ECHO. This operation may take a few minutes to complete depending on your PC Hardware.
ECHO. This operation will use a lot of CPU and Memory ressources.
ECHO. Your system may be hotter or may seem unresponsive while processing your request.
ECHO. Please do not interfer with the process before it has ended.
ECHO.
ECHO.
ECHO. Operation : %SRCtype% -^> %DSTtype%
ECHO. Output : %DSTtype% Image - All Indexes
ECHO. Source Path : %SRCPATH%
ECHO. Pattern : %SWMFILE%
ECHO. Destination Path : %DSTPATH%
ECHO. Compression Type : %COMPRESSIONTYPE%
ECHO.
ECHO. ================================================================
ECHO.
ECHO. EXPORTING INDEX %%i OF %images%
ECHO.
ECHO. PLEASE WAIT . . .
DISM /Export-Image /sourceimagefile:"%SRCPATH%" /swmfile:"%SWMFILE%" /SourceIndex:%%i /destinationimagefile:"%DSTPATH%" /Compress:%COMPRESSIONTYPE% /CheckIntegrity >NUL 2>&1
)
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
GOTO SUCCESS
::==================================================================
:: HERE ENDS THIS PART - CONVFRMSWM_ALL_INDEXES
::==================================================================
:SUCCESS
CLS
TITLE Success - Simple Windows Image Splitter/Merger - %SRCtype%2%DSTtype%
COLOR 17
ECHO.
ECHO. ================================================================
ECHO. Simple Windows Image Splitter/Merger
ECHO. Success
ECHO. ================================================================
ECHO.
ECHO. Successfully performed requested tasks.
ECHO.
ECHO. Operation : %SRCtype% -^> %DSTtype%
ECHO. Source Path : %SRCPATH%
ECHO. Destination Path : %DSTPATH%
ECHO. Compression Type : %COMPRESSIONTYPE%
ECHO.
ECHO.
ECHO. Thanks for using my script.
ECHO. GitHub Page : https://github.com/Studisys/Simple-Windows-Image-Splitter-Merger/
ECHO. Version : 0.5.0-beta
ECHO. Author : Joel Didier (Studisys)
ECHO. Twitter : https://twitter.com/Studisys
ECHO. Email : studisys@protonmail.com
ECHO.
ECHO. ================================================================
ECHO. Press 'Q' to exit, 'S' to start over
ECHO. ================================================================
ECHO.
CHOICE /c qs /n /m ""
IF %ERRORLEVEL%==1 EXIT
IF %ERRORLEVEL%==2 GOTO ADMIN_RIGHTS_ROUTINE
EXIT
:ERROR
TITLE Error - Simple Windows Image Splitter/Merger - %SRCtype%2%DSTtype%
COLOR 17
ECHO.
ECHO. ================================================================
ECHO. Simple WIM2ESD Converter
ECHO. Error
ECHO. ================================================================
ECHO.
ECHO. Something wrong occured . . .
ECHO.
ECHO. Currently, there is no log, except the one generated from DISM.
ECHO. This script will generate a complete log in the future.
ECHO. Please send me the error given by DISM and the log located in :
ECHO. C:\WINDOWS\Logs\DISM\dism.log
ECHO.
ECHO.
ECHO. Thanks in advance.
ECHO.
ECHO. GitHub Page : https://github.com/Studisys/Simple-Windows-Image-Splitter-Merger/
ECHO.
ECHO. Author : Joel Didier (Studisys)
ECHO. Twitter : https://twitter.com/Studisys
ECHO. Email : studisys@protonmail.com
ECHO.
ECHO. ================================================================
ECHO. Press 'Q' to exit, 'S' to start over
ECHO. ================================================================
ECHO.
CHOICE /c qs /n /m ""
IF %ERRORLEVEL%==1 EXIT
IF %ERRORLEVEL%==2 GOTO ADMIN_RIGHTS_ROUTINE
EXIT