![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Can I pass object along the pipeline to a ps1? Can I do something like this? ps|some.ps1|stop-process A workaround of sorts was to use something like this: ps|some_filter|stop-process some_filter was simply a filter declaration contained in a ps1 script that I dot-sourced containing something like: filter some_filter {$_.something} Marco |
| | #2 (permalink) |
| Guest | Re: Can I pass object along the pipeline to a ps1? "Marco Shaw" <marcoDOTshaw_@_gmailDOTcom> wrote in message news:OzLWE6eYHHA.4308@TK2MSFTNGP05.phx.gbl... > Can I do something like this? > > ps|some.ps1|stop-process Yep but either some.ps1 has to be in your path or you have to specify the full path to some.ps1. If the some.ps1 is in the current location then you can specify the path like so: ps | .\some \ stop-process -- Keith |
| | #3 (permalink) |
| Guest | Re: Can I pass object along the pipeline to a ps1? > ps | .\some \ stop-process Tried that but it didn't seem to work. I'll have to try again later. I must check if you call a filter like you do a function in scripts. Like having some.ps1 be: -----start filter some_filter {$_.something} .. some_filter -----end Marco |
| | #4 (permalink) |
| Guest | Re: Can I pass object along the pipeline to a ps1? Script blocks, functions, and scripts are all kinda related this way and allow begin, process, end such as PS C:\TEMP> cat myfilter.ps1 begin { echo "begin" } process { if ( $_.Name -like "zu*" ) { $_ } # Just output the ones you want (i.e. filter objects). } end { "end" } Output ---------------------------------- PS C:\TEMP> ps | .\myfilter begin Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName ------- ------ ----- ----- ----- ------ -- ----------- 40 2 716 2208 25 0.42 3856 ZuneLauncher 302 10 20644 25416 90 42.48 2332 ZuneNss end -- William Stacey [C# MVP] PCR concurrency library: www.codeplex.com/pcr PSH Scripts Project www.codeplex.com/psobject "Marco Shaw" <marcoDOTshaw_@_gmailDOTcom> wrote in message news:%23EPlHBfYHHA.1240@TK2MSFTNGP04.phx.gbl... |> ps | .\some \ stop-process | | Tried that but it didn't seem to work. I'll have to try again later. | | I must check if you call a filter like you do a function in scripts. | | Like having some.ps1 be: | -----start | filter some_filter {$_.something} | . some_filter | -----end | | Marco | | |
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| object pipeline? | Mike Blake-Knox | PowerShell | 10 | 09-08-2007 08:53 AM |
| How to pass object to XAML page | Lorenzo Soncini | Avalon | 0 | 10-23-2006 12:05 PM |
| Select a random object from pipeline effectively | =?Utf-8?B?Um9tYW4gS3V6bWlu?= | PowerShell | 1 | 09-21-2006 03:44 PM |
| WMI Object Win32_Product and Pipeline woes | machone3720 | PowerShell | 3 | 08-29-2006 09:05 AM |
| Add full (to pipeline) multicasting to tee-object? | Andrew Watt [MVP] | PowerShell | 2 | 07-12-2006 12:29 PM |