I am writing a batch file that runs other batch files (and some other things) for easier methods of running my Minecraft Bungeecord server.

This is the batch file, Run.bat, I am running from the server managing batch file:

@echo off
java -Xms512M -Xmx512M -jar BungeeCord.jar

And this is the section in the server managing batch where I run the file:

SET PATH=C:\Users\micah_000\Desktop\Server Files
cd %PATH%\Bungeecord
start Run.bat

When I run the Run.bat from the server managing batch this is what the cmd shows:

'java' is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . . .

When I run the Run.bat just by double clicking it, it works just fine.

Anyone have the same issue, or know how to fix it?

  • the issue isn't running the .bat file, it's the fact that the java command doesn't work when I do so – WeaponGod243 Mar 14 '18 at 14:55
  • Is the full path of java.exe present in the %PATH% environment variable? See it in control panel. – Biswapriyo Mar 14 '18 at 14:57
  • The java only doesn't work when the batch file that it is in is ran from another batch file. When I just run the batch file that the java command is in without the using of another, it works just fine. – WeaponGod243 Mar 14 '18 at 15:01
  • May be there is problem in set command. Use this tip. For example I want to add C:\foo\bar in PATH. Use set command as: SET PATH=C:\foo\bar;%PATH%. – Biswapriyo Mar 14 '18 at 15:07

SET PATH=C:\Users\micah_000\Desktop\Server Files cd %PATH%\Bungeecord

may be breaking your code. Could you please delete that, and instead just type this?

CD "C:\Users\micah_000\Desktop\Server Files\Bungeecord"

  • It was like that before, with the same results – WeaponGod243 Mar 14 '18 at 15:26
  • Can you find where javaw.exe is located? Normally, on an x64 system, it is located here: C:\Program Files\Java\your java version\bin\javaw.exe. – Ultrasonic54321 Mar 14 '18 at 15:30
  • I just switched it and you were right! The PATH was breaking it. – WeaponGod243 Mar 14 '18 at 15:35

Try replacing:

start run.bat

with either:

%comspec% /k run.bat


%comspec% /c run.bat

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.