myapp我尝试通过运行以下命令直接从命令提示符和批处理脚本中按名称查找应用程序:
D:\Files>wmic process where "commandline like '%myapp%'" get processid, commandline
CommandLine ProcessId
wmic process where "commandline like '%myapp%'" get processid, commandline 10744
myapp myarg1 myarg2 myarg3 2423
Run Code Online (Sandbox Code Playgroud)
我想过滤掉wmic进程条目本身。我尝试了以下命令:
D:\Files>wmic process where "commandline like '%myapp%' and commandline not like '%wmic%'" get processid, commandline
Node - XXXXXXXXXXX
ERROR:
Description = Invalid query
Run Code Online (Sandbox Code Playgroud)
但它会输出如上所示的错误。
我尝试手动跳过第一行,more +1但输出行(进程)的顺序可能会有所不同。
可以做什么来删除wmic进程条目?