I'm trying to write a .bat file that can look at clients that are in a file (hosts.txt) and see if calculator is running and kill it or them but it keeps say there are not instances found.
@echo off
cd \
for /F "tokens=1-2" %%a in ("hosts.txt") do (
wmic /node:%%a process where name='Calculator.exe' call terminate
)
What would be a better way of doing this or what am I missing?
My comment as an answer, (one line only):
The answer assumes you have privileges to do so, you may need to include
/user:privilegedusername
and/password:privilegeduserpassword
.