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 - Support for Named Pipe

Reply
 
Old 02-28-2007   #1 (permalink)
ktmd


 
 

Support for Named Pipe

Hi,
Does Powershell support named pipes like Unix shell does? like the pipe
madness example in this link http://www2.linuxjournal.com/article/2156

echo -n x | cat - pipe1 > pipe2 &
cat <pipe2 > pipe1

Thanks,
ktmd



My System SpecsSystem Spec
Old 02-28-2007   #2 (permalink)
Krishna Vutukuri[MSFT]


 
 

Re: Support for Named Pipe

Hi,

Powershell do not support named pipes. I am curious to know if you have any
specific scenario for this.

--
Thanks
Krishna[MSFT]
Windows PowerShell Team
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.

"ktmd" <ktmd@discussions.microsoft.com> wrote in message
news:7F5DE7E2-C95E-4AE1-AF9C-E3C04D548C8A@microsoft.com...
> Hi,
> Does Powershell support named pipes like Unix shell does? like the pipe
> madness example in this link http://www2.linuxjournal.com/article/2156
>
> echo -n x | cat - pipe1 > pipe2 &
> cat <pipe2 > pipe1
>
> Thanks,
> ktmd
>
>



My System SpecsSystem Spec
Old 02-28-2007   #3 (permalink)
William Stacey [C# MVP]


 
 

Re: Support for Named Pipe

Me to. It sounds interesting, but would files or even memory streams not
work in most cases?

--
William Stacey [C# MVP]
PCR concurrency library: www.codeplex.com/pcr
PSH Scripts Project www.codeplex.com/psobject


"Krishna Vutukuri[MSFT]" <kriscv@online.microsoft.com> wrote in message
news:%23gEYbQ3WHHA.3592@TK2MSFTNGP03.phx.gbl...
| Hi,
|
| Powershell do not support named pipes. I am curious to know if you have
any
| specific scenario for this.
|
| --
| Thanks
| Krishna[MSFT]
| Windows PowerShell Team
| Microsoft Corporation
| This posting is provided "AS IS" with no warranties, and confers no
rights.
|
| "ktmd" <ktmd@discussions.microsoft.com> wrote in message
| news:7F5DE7E2-C95E-4AE1-AF9C-E3C04D548C8A@microsoft.com...
| > Hi,
| > Does Powershell support named pipes like Unix shell does? like the pipe
| > madness example in this link http://www2.linuxjournal.com/article/2156
| >
| > echo -n x | cat - pipe1 > pipe2 &
| > cat <pipe2 > pipe1
| >
| > Thanks,
| > ktmd
| >
| >
|
|


My System SpecsSystem Spec
Old 02-28-2007   #4 (permalink)
ktmd


 
 

Re: Support for Named Pipe

Hi,

"Have you ever wanted to pipe your standard output to another set of
commands, but required some intervening non-pipelined step?" Oracle DBAs use
it a lot to export very large data to multiple drives, where disk space is
not available for temporary files.

The link here shows some usages
http://www.unixreview.com/documents/...1031588957510/

regards,
ktmd

"Krishna Vutukuri[MSFT]" wrote:

> Hi,
>
> Powershell do not support named pipes. I am curious to know if you have any
> specific scenario for this.
>
> --
> Thanks
> Krishna[MSFT]
> Windows PowerShell Team
> Microsoft Corporation
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "ktmd" <ktmd@discussions.microsoft.com> wrote in message
> news:7F5DE7E2-C95E-4AE1-AF9C-E3C04D548C8A@microsoft.com...
> > Hi,
> > Does Powershell support named pipes like Unix shell does? like the pipe
> > madness example in this link http://www2.linuxjournal.com/article/2156
> >
> > echo -n x | cat - pipe1 > pipe2 &
> > cat <pipe2 > pipe1
> >
> > Thanks,
> > ktmd
> >
> >

>
>
>

My System SpecsSystem Spec
Old 02-28-2007   #5 (permalink)
William Stacey [C# MVP]


 
 

Re: Support for Named Pipe

Not sure why can't use file here. You still need to create and remove the
pipe and it is file based, so wonder advantage here.

However, I did see a little ditty I forgot about. The "||" operator. Do
this, or if fails, do that. Kinda handy. psh have such a thing?

Example from the link:
mkfifo -m 660 $PIPE || (echo "cannot create named pipe"; exit 1)

--
William Stacey [C# MVP]
PCR concurrency library: www.codeplex.com/pcr
PSH Scripts Project www.codeplex.com/psobject


"ktmd" <ktmd@discussions.microsoft.com> wrote in message
news:3C947842-72C2-4467-B2BE-142A632A3BAB@microsoft.com...
| Hi,
|
| "Have you ever wanted to pipe your standard output to another set of
| commands, but required some intervening non-pipelined step?" Oracle DBAs
use
| it a lot to export very large data to multiple drives, where disk space
is
| not available for temporary files.
|
| The link here shows some usages
| http://www.unixreview.com/documents/...1031588957510/
|
| regards,
| ktmd
|
| "Krishna Vutukuri[MSFT]" wrote:
|
| > Hi,
| >
| > Powershell do not support named pipes. I am curious to know if you have
any
| > specific scenario for this.
| >
| > --
| > Thanks
| > Krishna[MSFT]
| > Windows PowerShell Team
| > Microsoft Corporation
| > This posting is provided "AS IS" with no warranties, and confers no
rights.
| >
| > "ktmd" <ktmd@discussions.microsoft.com> wrote in message
| > news:7F5DE7E2-C95E-4AE1-AF9C-E3C04D548C8A@microsoft.com...
| > > Hi,
| > > Does Powershell support named pipes like Unix shell does? like the
pipe
| > > madness example in this link http://www2.linuxjournal.com/article/2156
| > >
| > > echo -n x | cat - pipe1 > pipe2 &
| > > cat <pipe2 > pipe1
| > >
| > > Thanks,
| > > ktmd
| > >
| > >
| >
| >
| >


My System SpecsSystem Spec
Old 02-28-2007   #6 (permalink)
Chris Warwick


 
 

Re: Support for Named Pipe

On Wed, 28 Feb 2007 17:15:33 -0500, "William Stacey [C# MVP]"
<william.stacey@gmail.com> wrote:

>Not sure why can't use file here. You still need to create and remove the
>pipe and it is file based, so wonder advantage here.
>
>However, I did see a little ditty I forgot about. The "||" operator. Do
>this, or if fails, do that. Kinda handy. psh have such a thing?
>
>Example from the link:
>mkfifo -m 660 $PIPE || (echo "cannot create named pipe"; exit 1)



If you're interested because your wondering about pipeline
architecture, why named pipes might be useful and how to schedule
objects through a multistage/multipath pipeline I highly recommend you
take a look at these:

http://vm.marist.edu/~pipeline/mtpipe.pdf

http://vm.marist.edu/~pipeline/addpipe.pdf

Lots of other stuff about - let me know if you want more...

Good reading:-)

Cheers
Chris
My System SpecsSystem Spec
Old 03-01-2007   #7 (permalink)
ktmd


 
 

Re: Support for Named Pipe

I believe named pipe is a special file type known by the OS. It is treated
differently than a regular file. So it does NOT take up much disk space for
temporary storage.

I think it functions as a message queue that multiple OS processes can
access. Since Windows OS does not support named pipe like Unix does, I don't
think Powershell can support it easily.

The example below shows that 3 processes jointly work on a named pipe to
export a very large database. The script is easier to read than if you had
to use inline pipe to do the work. This would help if you had a very complex
logic to implement.

rm -f compress_pipe
rm -f export_pipe

# +---------------------------------------+
# | Make two new pipes (Compress / Split) |
# +---------------------------------------+
mknod compress_pipe p
mknod export_pipe p
chmod 666 export_pipe compress_pipe

# +---------------------------------------+
# | Start both the Split and Compress |
# | backgroud processes. |
# +---------------------------------------+
nohup split -b 1024m < export_pipe &
nohup compress < compress_pipe > export_pipe &

# +---------------------------------------+
# | Finally, start the export to both |
# | pipes. |
# +---------------------------------------+
exp userid=system/manager file=compress_pipe full=yes log=exportTESTDB.log

# +---------------------------------------+
# | Remove the pipes. |
# +---------------------------------------+
rm -f compress_pipe
rm -f export_pipe



"William Stacey [C# MVP]" wrote:

> Not sure why can't use file here. You still need to create and remove the
> pipe and it is file based, so wonder advantage here.
>
> However, I did see a little ditty I forgot about. The "||" operator. Do
> this, or if fails, do that. Kinda handy. psh have such a thing?
>
> Example from the link:
> mkfifo -m 660 $PIPE || (echo "cannot create named pipe"; exit 1)
>
> --
> William Stacey [C# MVP]
> PCR concurrency library: www.codeplex.com/pcr
> PSH Scripts Project www.codeplex.com/psobject
>
>
> "ktmd" <ktmd@discussions.microsoft.com> wrote in message
> news:3C947842-72C2-4467-B2BE-142A632A3BAB@microsoft.com...
> | Hi,
> |
> | "Have you ever wanted to pipe your standard output to another set of
> | commands, but required some intervening non-pipelined step?" Oracle DBAs
> use
> | it a lot to export very large data to multiple drives, where disk space
> is
> | not available for temporary files.
> |
> | The link here shows some usages
> | http://www.unixreview.com/documents/...1031588957510/
> |
> | regards,
> | ktmd
> |
> | "Krishna Vutukuri[MSFT]" wrote:
> |
> | > Hi,
> | >
> | > Powershell do not support named pipes. I am curious to know if you have
> any
> | > specific scenario for this.
> | >
> | > --
> | > Thanks
> | > Krishna[MSFT]
> | > Windows PowerShell Team
> | > Microsoft Corporation
> | > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> | >
> | > "ktmd" <ktmd@discussions.microsoft.com> wrote in message
> | > news:7F5DE7E2-C95E-4AE1-AF9C-E3C04D548C8A@microsoft.com...
> | > > Hi,
> | > > Does Powershell support named pipes like Unix shell does? like the
> pipe
> | > > madness example in this link http://www2.linuxjournal.com/article/2156
> | > >
> | > > echo -n x | cat - pipe1 > pipe2 &
> | > > cat <pipe2 > pipe1
> | > >
> | > > Thanks,
> | > > ktmd
> | > >
> | > >
> | >
> | >
> | >
>
>
>

My System SpecsSystem Spec
Old 03-02-2007   #8 (permalink)
jcarlos


 
 

Re: Support for Named Pipe

Yes, windows pipes are totaly different to Unix pipes. So, you can not
use them in the same way. I came across in the past with this problem
while exporting Oracle data in windows platforms and I developed a
couple a simple tools that helped me to compress "on-the-fly" the raw
output of windows programs.
You can read about these tools at http://jcarlossaez.spaces.live.com/b...B65C!108.entry

regards


My System SpecsSystem Spec
Old 03-02-2007   #9 (permalink)
ktmd


 
 

Re: Support for Named Pipe

Nice work.
It seems like with some clever programming, you or Powershell team can make
named pipe available.... Maybe .Net 3.0 has some features that will make it
easier?

regards.
k
"jcarlos" wrote:

> Yes, windows pipes are totaly different to Unix pipes. So, you can not
> use them in the same way. I came across in the past with this problem
> while exporting Oracle data in windows platforms and I developed a
> couple a simple tools that helped me to compress "on-the-fly" the raw
> output of windows programs.
> You can read about these tools at http://jcarlossaez.spaces.live.com/b...B65C!108.entry
>
> regards
>
>
>

My System SpecsSystem Spec
Old 03-03-2007   #10 (permalink)
Flowering Weeds


 
 

Re: Support for Named Pipe


Well if one is programming something:

Start looking at:

<quote>

This sample demonstrates the
netNamedPipeBinding binding, which
provides cross-process communication
on the same machine. Named pipes do
not work across machines. This sample
is based on The Getting Started Sample
calculator service.

In this sample, the service is self-hosted.
Both the client and the service are console
applications.

</quote>

NetNamedPipeBinding
http://msdn2.microsoft.com/en-gb/library/ms752247.aspx






My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Hyper-V -sharing modem for sbs server - How do you connect a com port to a named pipe Virtual Server
Setting COM Port Properties, Named pipe VB Script
Pipe Yes or No to cmdlet PowerShell
Pipe a pipe command to a file VB Script


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