Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista Tutorial - PowerShell: how to read Pipe.Input from a script?

Reply
 
Old 02-08-2008   #1 (permalink)
IgorM
Guest


 
 

PowerShell: how to read Pipe.Input from a script?

BTW: let me know if it's a wrong forum? Where is the PowerShell forum?

I've integrated the PS into my project and trying to invoke a script, but,
before hand, I'd like to populate a new pipeline with some data so the script
can process it, but, after writing it to the pipeline, I can't access it from
the script. How do I do this?

Here is the host code snippet:

foreach (PSObject obj in InputPipeline)
{
pipeline.Input.Write(obj);
}
pipeline.Input.Close();

OutputPipeline = pipeline.Invoke();

foreach (PSObject result in OutputPipeline)
{
// .... Do stuff here
}


And this is the list of different command permutations I've tried to run
(let's say I want just to print the input items):

$input | % "data: $_"
% "data: $_"
"data: $_"

Nothing worked. Any ideas?


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Using pipe in Powershell PowerShell
Functions: Taking input from the Pipe PowerShell
pipe to non-powershell process PowerShell
PowerShell: how to read Pipe.Input from a script? PowerShell
strange PowerShell pipe semantics PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46