Skip to content

Instantly share code, notes, and snippets.

@v1ctorio
Last active November 1, 2023 18:16
Show Gist options
  • Select an option

  • Save v1ctorio/b18721e2693c0574c0bb6101ead7b08d to your computer and use it in GitHub Desktop.

Select an option

Save v1ctorio/b18721e2693c0574c0bb6101ead7b08d to your computer and use it in GitHub Desktop.
@echo off
setlocal EnableDelayedExpansion
REM Generate random hash variable
set "chars=abcdefghijklmnopqrstuvwxyz"
set "hash="
for /L %%i in (1,1,10) do (
set /A "randNum=!RANDOM! %% 26"
for %%j in (!randNum!) do set "hash=!hash!!chars:~%%j,1!"
)
REM Create folder with hash name in Desktop
mkdir %USERPROFILE%\Desktop\%hash%
cd %USERPROFILE%\Desktop\%hash%
echo Created folder %hash% in Desktop
REM check if java is installed checking JAVA_HOME variable
set IS_JAVA_INSTALLED = set | findstr /i JAVA_HOME
where -q java
IF ERRORLEVEL 1 (
REM Download and extract
echo Downloading JAVA OpenJDK21...
curl https://download.java.net/java/GA/jdk21/fd2272bbf8e04c3dbaee13770090416c/35/GPL/openjdk-21_windows-x64_bin.zip -o java.zip
echo Extracting JAVA ...
mkdir C:\java
tar -xf java.zip -C C:\java
REM Clean up
del java.zip
echo Done.
echo Adding JAVA to PATH ...
setx PATH "%PATH%;C:\java\jdk-21\bin"
echo Setting JAVA_HOME ...
setx JAVA_HOME "C:\java\jdk-21"
echo Done.
echo JAVA installed
) else (
echo JAVA already installed
)
echo Downloading HMCL ...
curl -L https://github.com/huanghongxun/HMCL/releases/download/release-3.5.5/HMCL-3.5.5.exe > HMCL.exe
echo Done.
explorer .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment