我需要将下面后缀为sh的文件编译为后缀bat的文件#!usrbinenv bash# Start script generated by ServerPackCreator 421# Depending on which modloader is set different checks are run to ensure the server will start accordingly# If
以下是.sh文件编译为.bat文件后的代码:
@echo off REM Start script generated by ServerPackCreator 4.2.1. REM Depending on which modloader is set, different checks are run to ensure the server will start accordingly. REM If the modloader checks and setup are passed, Minecraft and EULA checks are run. REM If everything is in order, the server is started.
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" ( set "JAVA_ARCH=64" ) else ( set "JAVA_ARCH=32" )
if "%JAVA_HOME%"=="" ( if EXIST "%ProgramFiles(x86)%\Java\jdk1.8.0_%JAVA_ARCH%" ( set "JAVA_HOME=%ProgramFiles(x86)%\Java\jdk1.8.0_%JAVA_ARCH%" ) else ( set "JAVA_HOME=%ProgramFiles%\Java\jdk1.8.0_%JAVA_ARCH%" ) )
if "%JAVA_HOME%"=="" ( echo Java JDK not found. exit /b 1 )
set JAVA="%JAVA_HOME%\bin\java.exe"
echo Start script generated by ServerPackCreator 4.2.1. echo To change the launch settings of this server, such as JVM args / flags, Minecraft version, modloader version etc., edit the variables.txt-file.
REM Acquire variables from variables.txt call "variables.txt"
REM Variables with do_not_manually_edit are set automatically during script execution, REM so manually editing them will have no effect, as they will be overridden. set "MINECRAFT_SERVER_JAR_LOCATION=do_not_manually_edit" set "LAUNCHER_JAR_LOCATION=do_not_manually_edit" set "SERVER_RUN_COMMAND=do_not_manually_edit"
call :crash goto :eof
:crash echo Exiting... pause exit /b 1
REM %1 = Filename to check for REM %2 = Filename to save download as REM %3 = URL to download %2 from REM true if the file was successfully downloaded, false if it already exists :downloadIfNotExist if not exist "%~1" ( echo %~1 could not be found. echo Downloading %~2 echo from %~3 curl -# -L -o ".%~2" "%~3" if exist "%~2" ( echo Download complete. echo true ) ) else ( echo %~1 present. echo false ) goto :eof
:runJavaCommand "%JAVA%" %1 goto :eof
:checkJavaBitness "%JAVA%" -version 2>&1 | findstr /c:"32-Bit" && echo WARNING! 32-Bit Java detected! It i
原文地址: https://www.cveoy.top/t/topic/iFJH 著作权归作者所有。请勿转载和采集!