Here’s a quick demo on launching a Minecraft server in Windows using a .bat file.
- Right click in your folder and go to New > Text Document.
- Name it start_server.bat
- Hit Yes when windows asks if you’re sure about changing the extension.
- Now right click the file and hit Edit.
- Paste in the following text, and change it to match your situation. I’ll explain each part to better help you make the necessary changes.
12"C:\Program Files (x86)\Java\jre7\bin\java.exe" -Xmx1024M -Xms512M -jar forge_server.jar noguiPAUSE
- The first bit is a call to your system’s Java installation. It needs to be in quotes because of the space in Program Files (x86). To find yours, look in either your Program Files or Program Files (x86) to find Java.
- Next are two options that tell Java how much RAM it can use. -Xmx is the maximum, and -Xms is how much it’ll start with. You can specify in Megabytes or Gigabytes.
- Here’s the -jar option along with the name of your .jar file. Here you can just put the name of the .jar file you want to launch as long as it’s in the same directory as your .bat script.
- nogui tells the Minecraft server not to start the GUI part of the application. Opening the server through a script means it’ll be running in a console window. There’s no need for a GUI when you have a much better looking terminal to view.
- PAUSE simply makes the window wait for you to “hit any key to continue…” after you “stop” the server. I like doing this out of habit in certain situations, you can take it or leave it.
By simply changing the .jar file called by this script, you can use it to launch either a vanilla server or a modified server like Forge. I’m not a Windows script pro by any means (I’m usually using Linux), but if you have any questions please feel free to ask in the comments below!