forked from RDX-Sci01/ShadowMount1.3GBT
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmake_image.bat
More file actions
53 lines (41 loc) · 1.21 KB
/
make_image.bat
File metadata and controls
53 lines (41 loc) · 1.21 KB
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
@echo off
setlocal EnableExtensions
REM make_image.bat
REM Usage: make_image.bat "C:\images\data.exfat" "C:\payload"
if "%~1"=="" goto :usage
if "%~2"=="" goto :usage
set "IMAGE=%~1"
set "SRCDIR=%~2"
REM Script is expected to be in the same directory as this BAT
set "SCRIPT=%~dp0New-OsfExfatImage.ps1"
if not exist "%SCRIPT%" (
echo [ERROR] PowerShell script not found: "%SCRIPT%"
echo Put New-OsfExfatImage.ps1 next to this .bat file.
exit /b 2
)
if not exist "%SRCDIR%" (
echo [ERROR] Source directory not found: "%SRCDIR%"
exit /b 3
)
if not exist "%SRCDIR%\eboot.bin" (
echo [ERROR] eboot.bin not found in source directory: "%SRCDIR%"
exit /b 4
)
REM Run elevated? This BAT does not auto-elevate.
REM Right-click -> Run as administrator, or start cmd as admin.
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT%" -ImagePath "%IMAGE%" -SourceDir "%SRCDIR%" -ForceOverwrite
set "RC=%ERRORLEVEL%"
if not "%RC%"=="0" (
echo [ERROR] Failed with exit code %RC%.
exit /b %RC%
)
echo [OK] Done: "%IMAGE%"
exit /b 0
:usage
echo Usage:
echo %~nx0 "C:\path\to\image.img" "C:\path\to\folder"
echo.
echo Notes:
echo - Run this BAT as Administrator.
echo - Image will be auto-sized.
exit /b 1