Batch taskkill

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Leosko
Posts: 2
Joined: 01 Dec 2021 10:35

Batch taskkill

#1 Post by Leosko » 01 Dec 2021 10:53

Hello ,

i need help with batch command. I would like to kill one process but on a lot of hosts. Single command is taskkill s/"hosname" /FI "precess.exe" but i want to kill same process on approx. 100 hosts.
Can anybody help me?

Squashman
Expert
Posts: 4408
Joined: 23 Dec 2011 13:59

Re: Batch taskkill

#2 Post by Squashman » 01 Dec 2021 13:55

Create a file with each hostname on a separate line.

Code: Select all

FOR /F "usebackq delims=" %%G IN ("hostnames.txt") DO taskkill /S "%%G" /IM "precess.exe"

Leosko
Posts: 2
Joined: 01 Dec 2021 10:35

Re: Batch taskkill

#3 Post by Leosko » 02 Dec 2021 12:45

Squashman wrote:
01 Dec 2021 13:55
Create a file with each hostname on a separate line.

Code: Select all

FOR /F "usebackq delims=" %%G IN ("hostnames.txt") DO taskkill /S "%%G" /IM "precess.exe"
Perfect, it working. :) Thanks

Post Reply