-
Notifications
You must be signed in to change notification settings - Fork 0
/
Install OptiFine.bat
109 lines (74 loc) · 2.82 KB
/
Install OptiFine.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
@echo off
echo. >> InitLog.txt
echo [START] %date% %time% >> InitLog.txt
echo Optifine install with Minecraft built in Java >> InitLog.txt
echo OptiFine install with Minecraft built in Java
echo.
set javapath=C:\Program Files (x86)\Minecraft Launcher\runtime\jre-x64\bin\java
set /p optifinefile="OptiFine filename without file ending (.jar): "
echo Defined default java.exe path: "%javapath%" >> InitLog.txt
echo Defined OptiFine filename: %optifinefile%.jar >> InitLog.txt
echo.
echo Executing installation
"%javapath%" -jar %optifinefile%.jar
echo.
:errorcheck
if %errorlevel% equ 0 (
echo [SUCCESS] Executed installation successfully with %optifinefile%.jar file
echo [SUCCESS] Executed installation successfully with %optifinefile%.jar file >> InitLog.txt
goto exit
)
if %errorlevel% equ 1 (
echo [FAILED] Failed to find %optifinefile%.jar file
echo [FAILED] Error code: %errorlevel%
echo [FAILED] Failed to find %optifinefile%.jar file >> InitLog.txt
echo [FAILED] Error code: %errorlevel% >> InitLog.txt
goto newfilename
)
if "%customjavapathcheck%" equ "true" (
echo [FAILED] Failed to find java.exe path
echo [FAILED] Custom java.exe path: "%javapath%"
echo [FAILED] Error code: %errorlevel%
echo [FAILED] Failed to find java.exe path >> InitLog.txt
echo [FAILED] Custom java.exe path: "%javapath%" >> InitLog.txt
echo [FAILED] Error code: %errorlevel% >> InitLog.txt
goto customjavapath
)
if %errorlevel% equ 3 (
echo [FAILED] Failed to find java.exe path
echo [FAILED] Default java.exe path: "%javapath%"
echo [FAILED] Error code: %errorlevel%
echo [FAILED] Failed to find java.exe path >> InitLog.txt
echo [FAILED] Default java.exe path: "%javapath%" >> InitLog.txt
echo [FAILED] Error code: %errorlevel% >> InitLog.txt
goto customjavapath
)
if %errorlevel% neq 0 (
echo [FAILED] Failed to install %optifinefile%.jar file
echo [FAILED] Error code: %errorlevel%
echo [FAILED] Failed to install %optifinefile%.jar file >> InitLog.txt
echo [FAILED] Error code: %errorlevel% >> InitLog.txt
goto exit
)
:customjavapath
echo.
set /p javapath="Define custom path to java.exe file: "
set customjavapathcheck=true
echo Defined custom java.exe path: "%javapath%" >> InitLog.txt
echo.
echo Executing installation with custom Java path
"%javapath%" -jar %optifinefile%.jar
goto errorcheck
:newfilename
echo.
set /p optifinefile="OptiFine filename without file ending (.jar): "
echo Defined OptiFine filename: %optifinefile%.jar >> InitLog.txt
echo.
echo Executing installation
"%javapath%" -jar %optifinefile%.jar
goto errorcheck
:exit
echo.
echo Logged installation in log file InitLog.txt
echo [END] %date% %time% >> InitLog.txt
pause