Guides / Startup flags

How to make a start.bat for a Minecraft server

Make a Windows start.bat for your Minecraft server, with the right memory and flags, in two minutes.

Updated

A start.bat file starts your server on Windows with a double-click, and keeps your memory settings and flags in one place.

Make the file

  1. Open your server folder (the one with the server jar).
  2. Right-click, choose New → Text Document, and name it start.bat. Make sure it doesn't end in .txt: turn on View → File name extensions in File Explorer to check.
  3. Right-click it, choose Edit, and paste your script.

A basic script looks like this:

@echo off
java -Xms4G -Xmx4G -jar server.jar nogui
pause

For a tuned version with Aikar's flags and your memory and jar filled in, use the startup flags generator and pick Windows.

What each line does

  • @echo off hides the commands so the window only shows the server's output
  • java ... -jar server.jar nogui starts the server without the extra GUI window, which saves memory
  • pause keeps the window open if the server stops, so you can read any error

Common errors

  • "java is not recognized": Java isn't installed, or isn't on your PATH. Install the right version (see which Java version) and tick the option to add it to PATH.
  • "Unable to access jarfile": the jar name in the script doesn't match the file. Check the exact name, including capitals.
  • The window flashes and closes: you're missing the pause line, so you can't see the error.

Accept the EULA

The first start creates eula.txt. Open it, change eula=false to eula=true, and run start.bat again.

Work it out for your server

The free Startup flags generator gives you the exact settings for your setup.

Open the Startup flags generator →