![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| Guest | Bug? Shouldn't Stop-Process automatically match Id if object is a process? 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 Obviously this is because a System.Diagnostics.Process is not an Int32. Almost as obviously, if we could do this, it would in some ways make the InputObject not very useful and could arguably blur the distinction of Id. Still, if someone is specifying a process reference, it very clearly is a uniquely identified process which has an Id that can be determined. Therefore, it should be possible to for that special case simply resolve the item to an Id. Is this possible to do without making the Id surfacing too complex? And if so, is there a reason why it might be harmful to allow? |
My System Specs![]() |
| | #2 (permalink) |
| Guest | 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 |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Bug? Shouldn't Stop-Process automatically match Id if object is a "dreeschkind" <dreeschkind@discussions.microsoft.com> wrote in message news:1EA3B494-3BCC-431A-80F2-36F49752E29D@microsoft.com... > 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. Yeah, you would think that Stop-Process would recognize and understand how to stop a process described by a System.Diagnostics.Process object. Submit it and I'll vote on it. -- Keith |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: Bug? Shouldn't Stop-Process automatically match Id if object is a Alright guys - here it is: https://connect.microsoft.com/feedba...1919&SiteID=99 "Keith Hill [MVP]" <r_keith_hill@no.spam.thank.u.hotmail.com> wrote in message news:e0T0AVNlGHA.3816@TK2MSFTNGP02.phx.gbl... > "dreeschkind" <dreeschkind@discussions.microsoft.com> wrote in message > news:1EA3B494-3BCC-431A-80F2-36F49752E29D@microsoft.com... >> 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. > > Yeah, you would think that Stop-Process would recognize and understand how > to stop a process described by a System.Diagnostics.Process object. > Submit it and I'll vote on it. > > -- > Keith > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Process automatically switching to Low Priority | General Discussion | |||
| Problem with Measure-Object on get-process | PowerShell | |||
| New-object preventing process from exiting | PowerShell | |||
| get-process & stop-process by owner | PowerShell | |||
| measure-object {get-process} | PowerShell | |||