Board logo

标题: [系统相关] [已解決]批处理关闭指定路径进程 [打印本页]

作者: strong12345    时间: 2009-7-31 15:39     标题: [已解決]批处理关闭指定路径进程

知道wmic功能强大
但是不太会用
请问能够关闭指定路径进程吗?

例如现在tasklist中有3个game.exe正在执行
路径分别是
c:\111\game.exe
c:\222\game.exe
c:\333\game.exe

现在只想关掉 c:\111\game.exe
而另外2个不关闭

请问如何实现??

[ 本帖最后由 strong12345 于 2009-7-31 17:52 编辑 ]
作者: more    时间: 2009-7-31 15:48

用这个试试看能否自己弄一下???
  1. wmic process where name="game.exe" get executablepath,handle
复制代码

作者: slovent    时间: 2009-7-31 17:18

  1. wmic process where "name='game.exe' and ExecutablePath='c:\\111\\game.exe'" call Terminate
复制代码

作者: strong12345    时间: 2009-7-31 17:24

请问这怎么跟for合用?
会出了点问题
  1. for /f "tokens=1-2" %%a in ('wmic process where "name='game.exe'" get executablepath,handle^|findstr /c:"C:\111\game.exe"') do (echo %%b)
复制代码
get executablepath,handle
这里有问题
作者: slovent    时间: 2009-7-31 17:29

  1. @for /f %%i in ('wmic process where "name='game.exe' and ExecutablePath='c:\\111\\game.exe'"^| findstr /i "game.exe"') do (echo %%b)
复制代码

看看行不行
作者: Batcher    时间: 2009-7-31 17:30     标题: 回复 4楼 的帖子

逗号是命令分隔符之一,跟空格的作用差不多。这里需要转义。
作者: strong12345    时间: 2009-7-31 17:51

原来如此
感谢
问题已解决




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2