How to automate your CPU crypto currency mining whenever your Windows PC is idle


This post is to show you how to use Windows scheduler and batch script to setup an automation to automate the mining of your favorite crypto currency (Bitcoin, Litecoin, Dodgecoin, etc…) whenever the Windows PC screen is locked, AC power plugged in and idle. The following steps are based on Pooler CPU miner program. You will also need to have a pool mining account. I assume that you already know how to setup the CPU miner to mine from a mining pool and you already know how to setup the JSON configuration file.


Note: This post does not show you how to setup pool mining or creating an account for crypto currency.

Prepare a start mining batch script

1. Create a start_cpuminer.bat script file and copy and paste the template code below:
start /min /low [path-to-cpuminer-daemon-program] -c [path-to-json-cfg-file]

2. Replace the path to your Pooler CPU miner program and path to your JSON configuration file. Save the file after replacements.

Prepare a stop mining batch script

1. You will need this script to kill your cpuminer process whenever you unlock your PC screen. This is when you need to use your PC and you would like to use the CPU resource for your work.

2. Create a stop_cpuminer.bat script file and copy and paste the template code below:
taskkill /f /im minerd.exe

Setup Windows scheduled task to start mining

1.Run Windows Task Scheduler.

2. Create a task with the name "start cpuminer".

3. Set the trigger to begin the task "On workstation lock"

4. Set the action to "Start a program".

5. Under the Settings section, browse and select the start_cpuminer.bat script file you have created.

6. Under the "Conditions" tab, check these options:
  • Start the task only if the computer is on AC power. 
  • Stop if the computer switches to battery power. 

7. Click "OK" to complete the scheduled task creation.

Setup Windows scheduled task to stop mining

1. Create a task with the name "stop cpuminer".

2. Set the trigger to begin the task "On workstation unlock"

3. Under the "Advanced settings" section, set the task to run after 10 seconds of delay.

4. Set the action to "Start a program".

5. Under the Settings section, browse and select the stop_cpuminer.bat script file you have created.

6. Click "OK" to complete the scheduled task creation.

Now whenever your Windows PC screen is locked while an AC power is plugged in, the CPU miner program will start mining. When you unlock your Windows PC screen, the CPU miner program will stop.





Comments