我正在尝试打开一个批处理文件,该文件由另一个应该启动我的jar文件的批处理文件打开。
这是批处理文件的行,我用它来打开我的ServerStart.bat来启动我的jar文件。 (test.bat位于我的桌面上。)
set runmc1="C:\Game Host\mc_ftb_monster-1.6.4\ServerStart.bat"
这是ServerStart.bat
java -Xms2048m -Xmx2048m -XX:PermSize=128m -jar FTBServer-1.6.4-965.jar nogui
然后我明白了:http://i.imgur.com/MhV4xC7.jpg
我在谷歌上花了好几个小时,所以我在这里问你们所有人。有些人可以解释为什么这不起作用以及解决我遇到的这个问题的方法。
TEST.BAT:
:: Sets the text and background color of the CMD window
color 0a
::=================================================================::
:: Minecraft Server #1 ::
:: ::
:: Window and Log name, replace after = ::
set mc1=FTB 1.6.4
:: ::
:: Your start command, Replace after = ::
set runmc1="C:\Game Host\mc_ftb_monster-1.6.4\ServerStart.bat"
::=================================================================::
::=======================::
:: End of variables ::
::=======================::
:: This will keep the window clean and easy to read
@echo off
:: Sets the title of the window
title Utility Launcher 1.0
:: This variable takes you back to the main screen
:begining
:: Clears the window incase there is anything there
cls
:: Prints to the window what we are doing
echo Server Utility Launcher 1.0 has been started!
echo.
echo *************************************************
echo To close this Utility Launcher, close this window
echo *************************************************
echo 1. Start FTB 1.6.4
echo.
set /p a=
IF %a%==1 echo Starting %mc1%
cd "C:\Game host\mc_ftb_monster-1.6.4\"
start %runmc1%
pause
goto begining
ServerStart.bat:
cd "C:\Game host\mc_ftb_monster-1.6.4"
java -Xms2048m -Xmx2048m -XX:PermSize=128m -jar "FTBServer-1.6.4-965.jar" nogui
pause
答案 0 :(得分:1)
采取" nogui"关闭批处理文件中的命令行
答案 1 :(得分:0)
您正在访问正在执行它的文件夹的jar文件RELATIVE。
在ServerStart.bat中尝试此操作
java -Xms2048m -Xmx2048m -XX:PermSize=128m -jar "C:\Game Host\mc_ftb_monster-1.6.4\FTBServer-1.6.4-965.jar" nogui
所以,如果您执行ServerStart,它将在C:\ users \ username \ desktop \ FTBServer-1.6.4-965.jar中查找jar,它将找不到dit。
要确保Minecraft FTB服务器不在桌面上创建关卡文件,您必须在java命令之前添加以下行。
cd "C:\Game host\mc_ftb_monster-1.6.4"
所以总的来说,如果你想将它限制在你的目录中,你的蝙蝠就是:
cd "C:\Game host\mc_ftb_monster-1.6.4"
java -Xms2048m -Xmx2048m -XX:PermSize=128m -jar "FTBServer-1.6.4-965.jar" nogui
修改强>
尝试用以下代码替换你的最后一行:
IF %a%==1 echo Starting %mc1%
cd "C:\Game host\mc_ftb_monster-1.6.4\"
cmd /C %runmc1%
pause
goto begining