Need auto-restart script in batch for minecraft server

Solution 1: I would suggest to use the windows task scheduler instead of a batch file. There you can create a task, schedule it to be triggered at 12am/pm and insert any cmd command you want to be executed. However, it’s non-trivial to cummunicate with the server console without knowing the specific interface or how to administrate a minecraft server. What you can do is simply kill the server and restart it using the command line.

Solution 2: If you don’t like this solution and don’t know how to communicate with the server console you can try this: Take a look at AutoIt (https://www.autoitscript.com/site/). It’s a VERY simple script language which also can simulate click and input from the keyboard. So you can write a script that sets the focus to your server console and types the desired command to restart the server. This AutoIt script can be compiled to an exe file or you can run it as an au3 script. You should still use the task scheduler to run your exe/script at 12am/pm.

If you need some help writing the AutoIt script I can help you with that.

Leave a Comment