-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakeiso.bat
96 lines (78 loc) · 1.77 KB
/
makeiso.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
echo off
setlocal enabledelayedexpansion
set in=""
set out=""
set "oscdimg=c:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\oscdimg\oscdimg.exe"
set prog_name=%~n0%~x0
set user_dir="%~dp0"
set /a verbose=0
if [%1]==[] goto help
GOTO :ParseParams
:ParseParams
if [%1]==[/?] goto help
if /i [%1]==[/h] goto help
if /i [%1]==[/help] goto help
IF /i "%~1"=="/i" (
SET "in=%~2"
SHIFT
goto reParseParams
)
IF /i "%~1"=="/o" (
SET "out=%~2"
SHIFT
goto reParseParams
)
IF /i "%~1"=="/v" (
SET /a verbose=1
goto reParseParams
) else (
echo Skipping unknown option "%~1"
goto reParseParams
)
:reParseParams
SHIFT
if [%1]==[] goto main
GOTO :ParseParams
:main
if [%in%] == [] goto usage
if [%in%] == [""] goto usage
if [%out%] == [] goto usage
if [%out%] == [""] goto usage
call :isDir "%in%"
if [%errorlevel%] == [0] (
echo [e] %in% is not a directory!
goto usage
)
if NOT EXIST "%oscdimg%" (
echo [e] "%oscdimg%" not found!
goto usage
)
if %verbose% EQU 1 (
echo in = %in%
echo out = %out%
echo oscdimg = !oscdimg!
)
"%oscdimg%" -u2 "%in%" "%out%"
exit /B 0
:usage
echo Usage: %prog_name% /i "c:\winpe\iso" /o "c:\winpe\winpe.iso" [/v] [/h]
exit /B 0
:help
call :usage
echo.
echo Options:
echo /i Path to input directory.
echo /o Path to output directory.
echo /v Verbose mode.
echo /h Print this.
exit /B 0
:isDir
setlocal
set v=%~1
if [%v:~0,-1%\] == [%v%] (
if exist %v% exit /b 1
) else (
if exist %v%\ exit /b 1
)
exit /b 0
endlocal