|
RE: Bug? Shouldn't Stop-Process automatically match Id if object is a "Alex K. Angelopoulos [MVP]" wrote:
> Although you can pipe a process into Stop-Process, or specify it as an
> InputObject value, if you supply the process as a default value, it fails
> abysmally. For example:
>
> PS> calc;$calc = gps -Name calc
> PS> spps -InputObject $calc
> PS> calc;$calc = gps -Name calc
> PS> spps $calc
> Stop-Process : Cannot bind parameter 'Id'. Cannot convert "System.Diag
> nostics.Process (calc)" to "System.Int32".
> At line:1 char:5
> + spps <<<< $calc
Interesting, I would expect this to work.
Isn't this similar to e.g. the remove-item cmdlet?
Remove-Item accepts path names (Strings) and objects references
(System.IO.FileInfo). I think Stop-Process cmdlet should then support process
Id (Int32) and object references (System.Diagnostics.Process), too.
--
greetings
dreeschkind |