-
Notifications
You must be signed in to change notification settings - Fork 26
Entry level command line use
On windows you can click in the explorer url bar and type either of cmd or powershell.
Also on windows you can shift + right click in a folder and pick 'open cmd here' or 'open powershell here'.
java -jar serversync.jar
Passing arguments on the command line (or in batch files) is done after you call the program in question.
In our case we are calling java and passing it a flag "-jar" (java run a jar file if you could).
Then we pass what we want java to run, serversync (java run serversync please).
The second part of the call:
serversync.jar --server
Much the same, we are calling serversync and passing it the argument "server" (serversync run as a server bro)
All together we get: (java kind sir run serversync in server mode if you could my good hotmun), or in boring syntax:
java -jar serversync.jar --server
@echo off
SETLOCAL
FOR %%f IN (forge*.jar) DO (SET forge=%%~nxf)
FOR %%f IN (serversync*.jar) DO (SET serversync=%%~nxf)
START "Minecraft Server" java -Xms2g -Xmx2g -jar %forge% nogui
START "ServerSync Server" java -jar %serversync% --server
ENDLOCAL
Here we have a script, the problem we want to solve:
- Run forge with server related arguments
- Run serversync in server mode
Considerations:
- We dont want to have to update the script every time versions change
FOR %%f IN (forge*.jar) DO (SET forge=%%~nxf)
Loop through files that match (forge(anything).jar) and put the filename in the variable "forge"
START "Minecraft Server" java -Xms2g -Xmx2g -jar %forge% nogui
Start is a program like java or serversync, it has a required first argument which becomes the title of the started window "Minecraft Server". %forge% <- Access the variable we created earlier and place it here
This script uses start as we need to open two processes, if we had our script like so:
@echo off
SETLOCAL
FOR %%f IN (forge*.jar) DO (SET forge=%%~nxf)
FOR %%f IN (serversync*.jar) DO (SET serversync=%%~nxf)
java -Xms2g -Xmx2g -jar %forge% nogui <-- blocks here until completion
java -jar %serversync% --server
ENDLOCAL
Then the script would block on execution of the forge command and ServerSync would only run after forge shuts down, not really what we want.
How to guides
- Quick start guide
- Server setup
- Redirecting files
- Using the command line
- Excluding files from sync or deletion
- Banning clients
Multiple profile management
Troubleshooting