-
Notifications
You must be signed in to change notification settings - Fork 0
/
Installer.bat
286 lines (257 loc) · 11 KB
/
Installer.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
@echo off
set ver=Version 0.0.0
:start
if exist %0 ( curl --ssl-no-revoke -sL -o %0 https://github.com/ZoeyVid/Mod-Installer/releases/latest/download/Installer.bat )
FOR /F "usebackq" %%f IN (`PowerShell -NoProfile -Command "Write-Host([Environment]::GetFolderPath('Desktop'))"`) DO (
SET "DESKTOP_FOLDER=%%f"
)
if exist "%appdata%\.minecraft\fabric.jar" (
del /S /Q "%appdata%\.minecraft\fabric.jar"
)
if exist "%appdata%\.minecraft\fabric.bat" (
del /S /Q "%appdata%\.minecraft\fabric.bat"
)
if exist "%appdata%\.minecraft\Update.bat" (
del /S /Q "%appdata%\.minecraft\Update.bat"
)
if exist "%appdata%\.minecraft\essential-installer.exe" (
del /S /Q "%appdata%\.minecraft\essential-installer.exe"
)
if exist "%appdata%\.minecraft\forge.bat" (
del /S /Q "%appdata%\.minecraft\forge.bat"
)
CLS
echo.
echo GNU Affero General Public License v3.0
echo.
echo You can find the License here: https://github.com/ZoeyVid/Mod-Installer/blob/main/COPYING
echo.
echo NOT AN OFFICIAL MINECRAFT PRODUCT. NOT APPROVED BY OR ASSOCIATED WITH MOJANG.
echo.
echo Do you accept this?
echo.
echo 1. No
echo 2. Yes
echo.
CHOICE /C 12 /M " Selection: "
IF ERRORLEVEL 2 GOTO s
IF ERRORLEVEL 1 echo Aborting... & pause & EXIT /B
:s
CLS
where winget >nul 2>nul
if %errorlevel%==1 (
echo.
echo winget not found! Please check how you can install winget on your system!
Pause
exit
)
echo Please install now the Minecraft-Launcher:
Pause
start "" ms-windows-store://pdp/?ProductId=9pgw18npbzv5
CLS
C:
where java >nul 2>nul
if %errorlevel%==1 (
echo.
echo java is not installed, it will now be installed!
echo Start now?
Pause
winget install -e --id Amazon.Corretto.17
GOTO restart
)
if not exist "%appdata%\.minecraft" (
CLS
echo .minecraft folder not at the usual path or not available.
echo Under "%appdata%\.minecraft"
echo Unable to start Minecraft!
echo Do you want to open the Minecraft Launcher and test it again afterwards?
Pause
start "" shell:AppsFolder\Microsoft.4297127D64EC6_8wekyb3d8bbwe!Minecraft
echo Started?
Pause
TASKKILL /T /F /IM MinecraftLauncher.exe
TASKKILL /T /F /IM Minecraft.exe
GOTO restart
)
cd "%appdata%\.minecraft"
CLS
echo.
echo Welcome to the Mod-Installer Installer %ver%!
echo.
echo 1. Install/Repair
echo 2. Remove
echo 3. Cancel
echo.
CHOICE /C 123 /M " Selection: "
IF ERRORLEVEL 3 exit /B
IF ERRORLEVEL 2 GOTO rm
IF ERRORLEVEL 1 GOTO is
:is
CLS
echo Start Installation? The Minecraft Launcher will be closed!
Pause
cd "%appdata%\.minecraft"
TASKKILL /T /F /IM MinecraftLauncher.exe
TASKKILL /T /F /IM Minecraft.exe
if exist "%ProgramFiles(x86)%\Minecraft Launcher\MinecraftLauncher.exe" (
winget uninstall Mojang.MinecraftLauncher
)
if exist %appdata%\.minecraft\Download.ico ( del /S /Q %appdata%\.minecraft\Download.ico )
if exist %appdata%\.minecraft\Installer.ico ( del /S /Q %appdata%\.minecraft\Installer.ico )
if exist %appdata%\.minecraft\MC-Launcher.bat ( del /S /Q %appdata%\.minecraft\MC-Launcher.bat )
if exist %appdata%\.minecraft\Mod-Installer.bat ( del /S /Q %appdata%\.minecraft\Mod-Installer.bat )
if exist %appdata%\.minecraft\Installer-Uninstaller.bat ( del /Q /Q %appdata%\.minecraft\Installer-Uninstaller.bat )
if exist %DESKTOP_FOLDER%\Mod-Installer.lnk ( del /S /Q %DESKTOP_FOLDER%\Mod-Installer.lnk )
if exist %DESKTOP_FOLDER%\MC-Launcher.lnk ( del /S /Q %DESKTOP_FOLDER%\MC-Launcher.lnk )
if exist %appdata%\.minecraft\steam.txt ( del /S /Q %appdata%\.minecraft\steam.txt )
if exist %ProgramFiles%\Mod-Installer\steam.txt ( del /S /Q %ProgramFiles%\Mod-Installer\steam.txt )
if exist "%appdata%\Microsoft\Windows\Start Menu\Programs\Mod-Installer" ( rmdir /S /Q "%appdata%\Microsoft\Windows\Start Menu\Programs\Mod-Installer" )
if exist %appdata%\.minecraft\Mod-Installer ( rmdir /S /Q %appdata%\.minecraft\Mod-Installer )
if not exist "%LocalAppData%\Mod-Installer" (
mkdir "%LocalAppData%\Mod-Installer"
)
if exist "%LocalAppData%\Mod-Installer" (
cd "%LocalAppData%\Mod-Installer"
curl --ssl-no-revoke -L -o Mod-Installer.bat https://github.com/ZoeyVid/Mod-Installer/releases/latest/download/Mod-Installer.bat
curl --ssl-no-revoke -L -o MC-Launcher.bat https://github.com/ZoeyVid/Mod-Installer/releases/latest/download/MC-Launcher.bat
curl --ssl-no-revoke -L -o Installer-Uninstaller.bat https://github.com/ZoeyVid/Mod-Installer/releases/latest/download/Installer.bat
curl --ssl-no-revoke -L -o Mod-Installer.ico https://github.com/ZoeyVid/Mod-Installer/releases/latest/download/Mod-Installer.ico
curl --ssl-no-revoke -L -o Installer.ico https://github.com/ZoeyVid/Mod-Installer/releases/latest/download/Installer.ico
curl --ssl-no-revoke -L -o Launcher.ico https://github.com/ZoeyVid/Mod-Installer/releases/latest/download/Launcher.ico
)
if not exist mkdir "%appdata%\Microsoft\Windows\Start Menu\Programs\Mod-Installer" (
mkdir "%appdata%\Microsoft\Windows\Start Menu\Programs\Mod-Installer"
)
set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"
echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
echo sLinkFile = "%appdata%\Microsoft\Windows\Start Menu\Programs\Mod-Installer\MC-Launcher.lnk" >> %SCRIPT%
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
echo oLink.TargetPath = "%windir%\system32\cmd.exe" >> %SCRIPT%
echo oLink.Arguments = "/C %LocalAppData%\Mod-Installer\MC-Launcher.bat" >> %SCRIPT%
echo oLink.IconLocation = "%LocalAppData%\Mod-Installer\Launcher.ico" >> %SCRIPT%
echo oLink.Save >> %SCRIPT%
if exist %SCRIPT% ( cscript /nologo %SCRIPT% )
if exist %SCRIPT% ( del /S /Q %SCRIPT% )
set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"
echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
echo sLinkFile = "%appdata%\Microsoft\Windows\Start Menu\Programs\Mod-Installer\Mod-Installer.lnk" >> %SCRIPT%
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
echo oLink.TargetPath = "%windir%\system32\cmd.exe" >> %SCRIPT%
echo oLink.Arguments = "/C %LocalAppData%\Mod-Installer\Mod-Installer.bat" >> %SCRIPT%
echo oLink.IconLocation = "%LocalAppData%\Mod-Installer\Mod-Installer.ico" >> %SCRIPT%
echo oLink.Save >> %SCRIPT%
if exist %SCRIPT% ( cscript /nologo %SCRIPT% )
if exist %SCRIPT% ( del /S /Q %SCRIPT% )
set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"
echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
echo sLinkFile = "%appdata%\Microsoft\Windows\Start Menu\Programs\Mod-Installer\Installer-Uninstaller.lnk" >> %SCRIPT%
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
echo oLink.TargetPath = "%windir%\system32\cmd.exe" >> %SCRIPT%
echo oLink.Arguments = "/C %LocalAppData%\Mod-Installer\Installer-Uninstaller.bat" >> %SCRIPT%
echo oLink.IconLocation = "%LocalAppData%\Mod-Installer\Installer.ico" >> %SCRIPT%
echo oLink.Save >> %SCRIPT%
if exist %SCRIPT% ( cscript /nologo %SCRIPT% )
if exist %SCRIPT% ( del /S /Q %SCRIPT% )
CLS
echo Scripts were saved in "%LocalAppData%\Mod-Installer"!
echo Create desktop shortcuts?
echo.
echo 1. Yes
echo 2. No
echo.
CHOICE /C 12 /M " Selection: "
IF ERRORLEVEL 2 GOTO if
IF ERRORLEVEL 1 if exist "%DESKTOP_FOLDER%" ( GOTO l ) else ( GOTO if )
:l
set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"
echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
echo sLinkFile = "%DESKTOP_FOLDER%\MC-Launcher.lnk" >> %SCRIPT%
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
echo oLink.TargetPath = "%windir%\system32\cmd.exe" >> %SCRIPT%
echo oLink.Arguments = "/C %LocalAppData%\Mod-Installer\MC-Launcher.bat" >> %SCRIPT%
echo oLink.IconLocation = "%LocalAppData%\Mod-Installer\Launcher.ico" >> %SCRIPT%
echo oLink.Save >> %SCRIPT%
if exist %SCRIPT% ( cscript /nologo %SCRIPT% )
if exist %SCRIPT% ( del /S /Q %SCRIPT% )
set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"
echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
echo sLinkFile = "%DESKTOP_FOLDER%\Mod-Installer.lnk" >> %SCRIPT%
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
echo oLink.TargetPath = "%windir%\system32\cmd.exe" >> %SCRIPT%
echo oLink.Arguments = "/C %LocalAppData%\Mod-Installer\Mod-Installer.bat" >> %SCRIPT%
echo oLink.IconLocation = "%LocalAppData%\Mod-Installer\Mod-Installer.ico" >> %SCRIPT%
echo oLink.Save >> %SCRIPT%
if exist %SCRIPT% ( cscript /nologo %SCRIPT% )
if exist %SCRIPT% ( del /S /Q %SCRIPT% )
GOTO if
:if
PAUSE
CLS
if exist "%ProgramFiles%\Mod-Installer" (
CLS
echo.
echo Please delete the "%ProgramFiles%\Mod-Installer" Folder manually!
echo.
Pause
)
echo Finished! & Pause & exit /B
:rm
CLS
echo.
echo Remove?
echo.
echo 1. Yes
echo 2. No
echo.
CHOICE /C 12 /M " Selection: "
IF ERRORLEVEL 2 exit /B
IF ERRORLEVEL 1 GOTO rmy
:rmy
CLS
if exist "%ProgramFiles%\Mod-Installer" (
CLS
echo.
echo Please delete the "%ProgramFiles%\Mod-Installer" Folder manually!
echo.
Pause
)
if exist %appdata%\.minecraft\Download.ico ( del /S /Q %appdata%\.minecraft\Download.ico )
if exist %appdata%\.minecraft\Installer.ico ( del /S /Q %appdata%\.minecraft\Installer.ico )
if exist %appdata%\.minecraft\MC-Launcher.bat ( del /S /Q %appdata%\.minecraft\MC-Launcher.bat )
if exist %appdata%\.minecraft\Mod-Installer.bat ( del /S /Q %appdata%\.minecraft\Mod-Installer.bat )
if exist %appdata%\.minecraft\Installer-Uninstaller.bat ( del /Q /Q %appdata%\.minecraft\Installer-Uninstaller.bat )
if exist %DESKTOP_FOLDER%\Mod-Installer.lnk ( del /S /Q %DESKTOP_FOLDER%\Mod-Installer.lnk )
if exist %DESKTOP_FOLDER%\MC-Launcher.lnk ( del /S /Q %DESKTOP_FOLDER%\MC-Launcher.lnk )
if exist %appdata%\.minecraft\steam.txt ( del /S /Q %appdata%\.minecraft\steam.txt )
if exist %ProgramFiles%\Mod-Installer\steam.txt ( del /S /Q %ProgramFiles%\Mod-Installer\steam.txt )
if exist "%appdata%\Microsoft\Windows\Start Menu\Programs\Mod-Installer" ( rmdir /S /Q "%appdata%\Microsoft\Windows\Start Menu\Programs\Mod-Installer" )
if exist %appdata%\.minecraft\Mod-Installer ( rmdir /S /Q %appdata%\.minecraft\Mod-Installer )
CLS
echo.
echo Finished! Scripts were deleted!
echo Accidentally removed? https://github.com/ZoeyVid/Mod-Installer/releases/latest/download/Installer.bat
echo.
echo Remove Mod-Profils and the Backup?
echo Current loaded Mods are kept!
echo.
echo 1. Yes
echo 2. No
echo.
CHOICE /C 12 /M " Selection: "
IF ERRORLEVEL 2 if exist "%LocalAppData%\Mod-Installer" ( rmdir /S /Q "%LocalAppData%\Mod-Installer" & exit /B ) & exit /B
IF ERRORLEVEL 1 GOTO rmpb
exit /B
:rmpb
CLS
if exist %appdata%\.minecraft\Profil-* ( del /S /Q %appdata%\.minecraft\Profil-* )
if exist %appdata%\.minecraft\Backup.* ( del /S /Q %appdata%\.minecraft\Backup.* )
CLS
echo.
echo Finished! Profils and Backups had been removed!
echo Accidentally removed? https://github.com/ZoeyVid/Mod-Installer/releases/latest/download/Installer.bat
echo.
Pause & if exist "%LocalAppData%\Mod-Installer" ( rmdir /S /Q "%LocalAppData%\Mod-Installer" & exit /B ) & exit /B
exit /B
:restart
start %ComSpec% /C %0
EXIT /B