从杀包含字符串BAT文件具体的cmd.exe [英] Kill specific cmd.exe from BAT file containing string

查看:162
本文介绍了从杀包含字符串BAT文件具体的cmd.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前运行到哪里了的cmd.exe的过程,尽管被停止某项服务仍然有效的问题。这又是造成该文件夹上执行动作,$ P $被改名pventing它自动运行的脚本问题/移动/等。

由于我的自动化脚本从一个BAT文件运行,我相信我可以TASKKILL杀死它。使用进程资源管理器,我搜索的文件夹名称,它能够找到cmd.exe的这是使用它。我无法找到一种方法,如果没有某种类型的包含字符串自动完成这个虽然。我的伪例子是...

  TASKKILL / IM的cmd.exe / FINAME包含TC38247178584278321320778
PHP \\ php.exe的migration.php TC38247178584278321320778

在这里输入的形象描述


解决方案

  WMIC过程,其中命令行LIKE'%TC38247178584278321320778%'得到的名字

要看看下一个命令将杀害

  WMIC过程,其中LIKE'%TC38247178584278321320778%命令行呼叫终止

请参阅 WMIC /? WMIC进程/? WMIC过程获取/? WMIC过程调用/? WMIC流程设置/? WMIC /格式/? WMIC /节点/?

如同 0或多个字符, _ 是一个单字符。否则 =,<&GT中,<,&GT中,< =,=方式>

I am currently running into an issue where a "cmd.exe" process remains active despite a particular service being stopped. This in turn is causing problems for an automated script that performs actions on the folder, preventing it from being renamed/moved/etc.

As my automated script runs from a BAT file, I believe I can kill it with TASKKILL. Using "Process Explorer", I searched for the folder name and it was able to locate the "cmd.exe" that was using it. I am having trouble finding a way to automate this though without some type of "Contains String". My pseudo example is...

taskkill /IM cmd.exe /FI "NAME contains TC38247178584278321320778"
php\php.exe migration.php TC38247178584278321320778

解决方案

wmic process where "commandline like '%TC38247178584278321320778%'" get name

to see what next command will kill

wmic process where "commandline like '%TC38247178584278321320778%'" call terminate

See wmic /?, wmic process /?, wmic process get /?, wmic process call /?, wmic process set /?, wmic /format /?, wmic /node /?, etc.

Like is % 0 or more characters and _ is a single character. Otherwise =, <>, <, >, <=, =>.

这篇关于从杀包含字符串BAT文件具体的cmd.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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