-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.bat
74 lines (60 loc) · 1.89 KB
/
run.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
@echo off
setlocal enabledelayedexpansion
IF EXIST "output" (
echo Folder "output" exists. Deleting...
rmdir /s /q "output"
echo Folder "output" has been deleted.
) ELSE (
echo Folder "output" does not exist.
)
IF EXIST "downloads" (
echo Folder "downloads" exists. Deleting...
rmdir /s /q "downloads"
echo Folder "downloads" has been deleted.
) ELSE (
echo Folder "downloads" does not exist.
)
rem GitHub repository information
set repoOwner=RaphiMC
set repoName=JavaDowngrader
set releaseTag=v1.1.2
set jarFileName=JavaDowngrader-Standalone-1.1.2.jar
rem Download URL construction
set downloadUrl=https://github.com/%repoOwner%/%repoName%/releases/download/%releaseTag%/%jarFileName%
rem Download the specific JAR file from GitHub
echo Downloading %jarFileName% from GitHub release %releaseTag%
curl -L -o %jarFileName% %downloadUrl%
rem URL list file
set urlList=url_list.txt
rem Directory to save downloaded files
set downloadDir=downloads
rem Create the download directory if it doesn't exist
if not exist %downloadDir% (
mkdir %downloadDir%
)
rem Download each file from the URL list
for /f "delims=" %%u in (%urlList%) do (
echo Downloading %%u
curl -o %downloadDir%\%%~nzu.jar %%u
)
rem Change to the download directory
cd %downloadDir%
set outputDir=output
rem Create the output directory if it doesn't exist
if not exist %outputDir% (
mkdir %outputDir%
)
rem Loop through all .jar files in the download directory
for %%f in (*.jar) do (
rem Check if the file name contains the jarFileName
echo %%f | find /I "%jarFileName%" >nul
if errorlevel 1 (
rem If the jarFileName is not found in the file name, execute your command
echo Processing file: %%f
rem Downgrade every jar file
java -jar ../%jarFileName% --input %%f --version 8 --output ../output/downgraded-%%f
) else (
echo Skipping file: %%f
)
)
endlocal