Page 1 of 1

Batch taskkill

Posted: 01 Dec 2021 10:53
by Leosko
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?

Re: Batch taskkill

Posted: 01 Dec 2021 13:55
by Squashman
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"

Re: Batch taskkill

Posted: 02 Dec 2021 12:45
by Leosko
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