-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRepairImage.cmd
More file actions
84 lines (73 loc) · 1.5 KB
/
Copy pathRepairImage.cmd
File metadata and controls
84 lines (73 loc) · 1.5 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
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
@echo off
setlocal EnableExtensions
cd /d "%~dp0"
set "SCRIPT=%~dp0ImageRepairTool.ps1"
set "INTERACTIVE=0"
if not "%~1"=="" (
set "INPUT=%~1"
goto RUN_OPEN
)
:MENU
set "INTERACTIVE=1"
cls
echo AI Image Repair Tool
echo.
echo 1. Process default resource folder
echo 2. Enter image or folder path
echo 3. Check environment
echo 4. Show help
echo Q. Quit
echo.
choice /C 1234Q /N /M "Choose: "
if errorlevel 5 exit /b 0
if errorlevel 4 goto SHOW_HELP
if errorlevel 3 goto RUN_CHECK
if errorlevel 2 goto ASK_PATH
if errorlevel 1 (
set "INPUT=.\resource"
goto RUN_OPEN
)
:ASK_PATH
set "INPUT="
set /P "INPUT=Drop/paste image or folder path, then press Enter: "
if "%INPUT%"=="" goto MENU
set "INPUT=%INPUT:"=%"
goto RUN_OPEN
:RUN_OPEN
echo.
echo Input: %INPUT%
echo.
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT%" -Input "%INPUT%" -Open
set "EXIT_CODE=%ERRORLEVEL%"
goto HANDLE_RESULT
:RUN_CHECK
echo.
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT%" -Check
set "EXIT_CODE=%ERRORLEVEL%"
if "%INTERACTIVE%"=="1" (
echo.
pause
goto MENU
)
exit /b %EXIT_CODE%
:SHOW_HELP
echo.
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT%" -Help
echo.
pause
goto MENU
:HANDLE_RESULT
echo.
if not "%EXIT_CODE%"=="0" (
echo Failed with exit code %EXIT_CODE%.
echo Check the messages above, or run:
echo powershell -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT%" -Help
echo.
pause
)
if "%INTERACTIVE%"=="1" (
echo Done.
echo.
pause
)
exit /b %EXIT_CODE%