Sha*_*evy 45
您可以获取应用程序路径:
Get-Process | Where-Object {$_.Path -like "*something*"} | Stop-Process -WhatIf
Run Code Online (Sandbox Code Playgroud)
这只适用于本地机器.要终止远程进程:
Get-WmiObject Win32_Process -Filter "ExecutablePath LIKE '%something%'" -ComputerName server1 | Invoke-WmiMethod -Name Terminate
Run Code Online (Sandbox Code Playgroud)
我想稍微改进 Shay Levy 的回答,因为它在我的设置(powershell 的第 4 版)上效果不佳
Get-Process | Where-Object {$_.Path -like "*something*"} | Stop-Process -Force -processname {$_.ProcessName}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
27105 次 |
| 最近记录: |