BAT files for mining, explained
What a miner start script (.bat or .sh) is, the parts of the command every miner shares, and how to edit the file safely on Windows and Linux.
What is a BAT file for mining?
A .bat file is a plain text file of commands that Windows runs in order. On Linux, a .sh file does the same job. Miners ship with one so you do not have to type the full start command every time.
Double-click the file and the miner starts with your saved settings. There is no magic inside. Open it in any text editor and you will find one long command line.
What is in the start command?
A flag is an option on the command line that sets one value. Miners name their flags differently, but every command has the same parts:
- The executable: the miner program itself, first on the line.
- The algorithm flag: tells the miner what to compute. It must match the coin.
- The pool flag: the stratum host and port of your closest region. Stratum is the protocol miners use to talk to a pool, and the How to Mine page lists both values.
- The user or wallet flag: your wallet address. You can add a worker name after a dot.
- Optional flags: a log file, an API port for monitoring, and intensity or tuning options.
Each miner has its own flag names. The SRBMiner setup guide in this help center shows them exactly, and other miners list theirs in their own documentation.
How do you edit the file safely?
Never double-click the file to edit it, because that runs it. Follow these steps instead:
- Right-click the file and choose Edit.
- Change only the values, never the flag names.
- Keep everything on one line, unless the file already uses continuation characters.
- Save the file as plain text.
Does the window flash open and close at once? On Windows, add a new last line with the word "pause". The window then stays open and shows the error message that explains what is wrong.
Should you keep one file per coin or rig?
Yes. Keep a separate start file for each coin and for each rig that is set up differently. Name each file so you can tell them apart.
When you change your wallet, region or worker name, change it in the file, not in the console. The file is the configuration that survives a reboot.