0
我知道,工作代码是Powershell查杀流程 - 我的字符串有什么问题?
Get-Process firefo* | Stop-Process
但我的第一个猜测是
Get-Process | findstr firefox | Stop-Process
它没有工作。
Stop-Process : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input. At line:1 char:33 + Get-Process | findstr firefox | Stop-Process + ~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: ( 1379 317... :PSObject) [Stop-Process], ParameterBindingException + FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Commands.StopProcessCommand
据我所知,串
1342 306 1228412 1279864 -1671 ...71,42 35912 firefox
是坏的过程中杀死,但为什么呢?
PS C:\Users\adamg> Get-Process firefo*
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
1342 306 1228412 1279864 -1671 ...71,42 35912 firefox
上面的工作很好,即使列标题在回复。
您必须查看cmdlet的'Get-Help -full'并查看Input和Output对象。 dos命令'findstr'只生成控制台文本作为输出,不能用作Powershell cmdlet的输入。 – user4317867