0

The following are used in a .bat file on Windows 10 Home Edition 64-bit.

taskkill /f /im notepad.exe

It can kill notepad.exe

taskkill /f /im speedfan.exe

It cannot kill speedfan.exe

C:\Program Files (x86)\SpeedFan\speedfan.exe

How can I kill speedfan.exe?

2 Answers2

2

My guess is that because Speedfan requires special privileges in the system it is not run as your current user but runs under one of the administrator users and as a result only an elevated taskkill can kill it. I suspect that without administrator rights your batch file will also not be able to run Speedfan without a UAC prompt.

If you are wanting to do this every time your computer wakes then the best way will be via a Scheduled Task. The benefit to this is that a scheduled task can run as an elevated user and so your batch file will be able to both kill and restart Speedfan without needing you to specifically do a "Run as Administrator" or click OK to a UAC elevation prompt.

It also means that your batch file will run every time your sleep event happens.

You can get to the Task Scheduler via Control Panel -> System and Security -> Administrative Tools -> Task Scheduler

Once there you should be able to select "Create Task" enter image description here

Then in that window select "Run with highest privileges":

enter image description here
(If that doesn't work then retry it as the "system" account using the "Change User or Group" button and searching on "system".)

Under the Trigger tab click "New" and change "Begin the task:" from "On a schedule" to "On an event"

The "wake from sleep" event appears to be emitted from Kernel-Power and is Event ID 42 (that page also lists Power-Troubleshooter and Event ID 1 as an alternative) so set up your trigger to the following

  • Log: System
  • Source: Kernel-power
  • Event ID: 42

enter image description here

Click "OK" and then under the actions tab in the main task window you can add your batch file.

Hopefully that should allow you to run your batch file as an elevated user and thus kill and restart Speedfan properly from it.

Mokubai
  • 95,412
0

If you just want to kill the process, I recommend you to use Process Hacker. It's like the taskmanager but can kill any process. Process Hacker