Kill process with batch

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
jebediah
Posts: 1
Joined: 20 Aug 2022 06:54

Kill process with batch

#1 Post by jebediah » 20 Aug 2022 07:02

Hi guys.
I've been trying to kill a process with a batch file but it seems like neither batch or Powershell works.
There's no problem with killing the process via taskmanager.

Here's what i've tried

Code: Select all

taskkill /F /IM task.exe
If i put a pause in the code it just says

ERROR: The process "task.exe" with PID 9204 could not be terminated
Reason: No instance of activity is running

I've tried taskkill with the PID as well and that gave me same error.
Any ideas what i'm doing wrong here?

ShadowThief
Expert
Posts: 1160
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Kill process with batch

#2 Post by ShadowThief » 21 Aug 2022 13:37

How do you know you're passing the correct executable name to taskkill? Does it appear in tasklist?

Post Reply