I am running mining on Windows 10 Pro in Microsoft Azure using MSYS2 MinGW 64-bit.

My process to mine currently is:

  1. OPEN a MSYS2 terminal (lets call this MSYS2 A), navigate to appropriate directory and run ./monerod --offline

  2. OPEN another terminal of MSYS2 (lets call this MSYS2 B), navigate to appropriate directory and run ./monero-wallet-cli. Follow the instructions for loading a wallet. Enter start_mining [thread count]

  3. Go back MSYS2 A, and run show_hr

My question: Is there any way to automate the process of starting mining in MSYS2 windows e.g. something equivalent of having a .bat file in a CMD window in a start menu.

Bonus question: Is there any way to be alerted if mining fails and to automatically restart the service?

  • Scheduled Tasks pointing to the .bat or PowerShell script? I'm sure PS can monitor running processes and alert and restart if they stop. (I'm more a bash guy then PowerShell, so can't help much more then that. But i'm positive its do-able) – Dave Jul 4 at 10:56
  • its not .bat or PowerShell. Its MSYS2 which is the pre-requisite for mining monero – James Jul 4 at 11:32
  • "Its MSYS2 which is the pre-requisite for mining monero" <= It's not. – dEBRUYNE Jul 4 at 14:28
  • MSYS2 is a pre-requisite for mining on windows. See github.com/monero-project/monero "On Windows: Binaries for Windows are built on Windows using the MinGW toolchain within MSYS2 environment. The MSYS2 environment emulates a POSIX system. The toolchain runs within the environment and cross-compiles binaries that can run outside of the environment as a regular Windows application. Preparing the build environment Download and install the MSYS2 installer..." – James Jul 6 at 9:08

MSYS2 is needed to build on windows.
However, you can mine directly within the regular windows command line, that's what i am doing.
So you might be able to create a bat file to:

  • Launch monerod
  • Start mining to your address within monerod, or in another window with monero-wallet-cli.

Try something like:

cd <path/to/monerod/folder>
monerod.exe --start-mining <address> --mining-threads <threads>
goto loop

For more sophisticated stuffs, try using "expect" to start "show_hr".

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.