如何在多个工作站上终止单个进程 [英] How to kill a single process on multiple workstations

查看:73
本文介绍了如何在多个工作站上终止单个进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个.bat文件,该文件可以查看文件(hosts.txt)中的客户端,并查看计算器是否正在运行并杀死它或它们,但是它一直说未找到实例。 / p>

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?

推荐答案

我的评论为答案,(仅一行)

@WMIC /Node:@hosts.txt Process Where "Name='calc.exe'" Call Terminate

答案假定您具有特权,您可能需要包括 / user:privilegedusername / password:privilegeduserpassword

The answer assumes you have privileges to do so, you may need to include /user:privilegedusername and /password:privilegeduserpassword.

这篇关于如何在多个工作站上终止单个进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆