#1 - the most common purpose of a batch file is "I keep running this exact sequence of commands quite often, let's make a shortcut that will run them for me"
On windows, batch files have the extension .bat or .cmd; other systems have different conventions.
They are usually just literally the same commands you would use on a command prompt, in a text file, one on a line. They can also use some control flow commands (if/then, ...).
#2 - I think I should mention that this is more of a template for commands to run, rather than a complete batch file
- for one, you probably shouldn't put mafia's source code directly in the root directory (for most windows people, \kolmafia will be the same as c:\kolmafia); so you are expected to substitute the directory where the sources really are on your computer
- Ant is a program used to automate some developer/programmer tasks; somebody writes rules in a file (build.xml) and then ant knows how to do things.
Specifically with mafia's configuration:
-- "ant update" = get the newest kolmafia sources (from sourceforge's svn repository, which is where mafia's developers put it)
-- "ant" = does the default thing, which is "build the .jar file"
-- "&" on windows, "cmd1 & cmd2" means "run cmd1; stop if it failed, otherwise run cmd2" (on other systems it means other things; for example on unix it means "run cmd1 in the background, and meanwhile run cmd2" , which isn't what you want here)
- <something> - this is how we sometimes indicate "placeholders" - you would not literally type "cd <mafiafolder>", you would substitute your own choice of folder
-- this is obvious to some, but not to all: <mafiafolder> is the folder where you will be running the program; on windows this means that all the settings, scripts, logs, ... will be there (you already have this folder, it's the folder from which you are running the downloaded .jar file)
-- so for example this could actually be cd c:\games\kolmafia
(note that all these \ characters are backslashes, even though they look like pipe characters to me in this browser)
- copy /y \kolmafia\dist\kol[tab] <either . or standard mafia filename>
-- again, \kolmafia is the same folder where you put kolmafia's source, so use the same value as in the "cd" command for this part (but you still have to continue with \dist\kol)
-- [tab] is where you press the TAB key on your keyboard - this will "autocomplete", i.e. the command prompt will fill in the rest of the name (and it will even be correct, if there's only one possibility; on windows, you can press TAB multiple times to cycle through possibilities, other systems have different ways). This does not work in a batch file, you have to specify the full path explicitly ... or use wildacrds:
-- copy /y \kolmafia\dist\kol*.jar kolmafia.jar
---- note: this wouldn't work if there were several different .jar files in the dist folder - the copy command would take them all and paste them all right one after another, creating an invalid .jar file; but mafia's ant is configured to empty the dist folder before building, so there will only be one
-- the <. or standard mafia filename> placeholder asks you to choose: if you use ".", it will copy the entire name of the built .jar file, which will eventually change (the one I built just now on this machine is KolMafia-17.3.jar), and when it does change, you would have to change the last line of the batch file to run the new .jar
or you can use a non-changing name of your own choice (my choice here is "kolmafia.jar")
- javaw -jar <jarfile>
-- <jarfile> is placeholder for the file created by the previous "copy" command; so in my case it would just be "kolmafia.jar"
-- the "-jar" parameter is important. Without it, java will *not* understand that you want it to run a .jar file, it would try to do something very different, look for a different file, not find it, and complain (and the error message can be confusing)
-- javaw is one of java's way to run java programs - this one runs "in a windowed mode", which means that it won't tell you what went wrong when inevitably something goes wrong; on the other hand, it won't make you keep a command prompt window open (the command prompt is where you can see some thing that go wrong ... and some that go right)
(I would use "java -jar kolmafia.jar", at least until I was sure that everything works)