1

Hey kind of a noob with this stuff.

But I set up a task scheduler to when idle for 5 minutes, run a .bat.

I also have it set to "Do not run multiple instances", yet whenever I come back after an hour, there are 2 or sometimes more instances of the bat running.

Any way to easily stop this?

fixer1234
  • 27,064
  • 61
  • 75
  • 116
  • What is your bat doing ? Could you share its content ? – Ob1lan Dec 14 '17 at 10:38
  • It's an ethereum miner Claymore. – user4340635 Dec 14 '17 at 11:51
  • setx GPU_FORCE_64BIT_PTR 0 setx GPU_MAX_HEAP_SIZE 100 setx GPU_USE_SYNC_OBJECTS 1 setx GPU_MAX_ALLOC_PERCENT 100 setx GPU_SINGLE_ALLOC_PERCENT 100 EthDcrMiner64.exe -epool – user4340635 Dec 14 '17 at 11:52
  • Please [edit] your response into your question. – I say Reinstate Monica Dec 14 '17 at 13:11
  • What do you see that indicates two instances of the process are running exactly? I assume you're not seeing instances of cmd.exe which is what the task scheduler executes and you are seeing multiple ***something else*** that indicates this? Probably an easy solution to prevent this issue and the Task Scheduler is likely working as expected and it's something else you see that indicates the issue you are trying to prevent. The task scheduler will execute the batch script which probably triggers something else, and you assume it's Task Scheduler and it's probably not. Disclose all the detail. – Vomit IT - Chunky Mess Style Dec 14 '17 at 13:41
  • Basically the .bat runs a crypto currency miner in a command prompt window. There will be multiple of these open when I come back from the computer, that is what I mean by multiple instances. – user4340635 Dec 14 '17 at 21:32
  • So the name of the process you see multiple of is named `EthDcrMiner64.exe`, correct? If so then consider using a similar script as I provided in this answer https://superuser.com/questions/1097766/windows-task-scheduler-run-task-if-task-isnt-running/1097805#1097805. The `SET EXEName=EthDcrMiner64.exe` and then right beneath the `:StartSpeedFan` put your other logic for the mining, etc. Just be sure the logic that checks whether or not the process is already running is at the top and runs first always. It'll only execute the process if it is not running regardless of the Task Scheduler run. – Vomit IT - Chunky Mess Style Dec 14 '17 at 23:21
  • In addition to the above comment and link I provided, read over my answer here: https://superuser.com/questions/1214736/windows-10-scheduled-tasks-with-workstation-lock-unlock-not-being-triggered/1217125#1217125 for further tips, etc. just in case you find any of that helpful. Implementing a solution as per the first comment should work for you though. Please give me your feedback or tell me if you have any trouble or questions. – Vomit IT - Chunky Mess Style Dec 14 '17 at 23:22
  • Thanks, I am going to try that when I get home. And sorry I know noob question but when it says "schedule this to run" - I assume I paste that code into a text editor and edit it to my situation, but what do I save it as to run in task scheduler? Also, would I run this in the same task scheduler action as the bat? or as a different thing? Will it close the oldest or newest version of the .bat? My worry is that if I have my bat set to run if idle for 5 minutes, won't it costantly open and shut new instances? – user4340635 Dec 15 '17 at 00:00
  • To be clear of my goal. I want when I leave my computer for 5 minutes or more the .bat to run which runes EthDcrMiner64.exe with the paramters set in my .bat - does that script check to see if it is open already? and then refuse to if it already is? That is kind of what I'm looking to have happen here. – user4340635 Dec 15 '17 at 00:04

1 Answers1

0

You can limit the max amount of time a task should run, so if you set it to 4 minutes you probably are set.

Ignacio Soler Garcia
  • 2,015
  • 5
  • 20
  • 27