Is there an easy way to test whether your named pipe is working correctly? I want to make sure that the data I'm sending from my app is actually being sent. Is there a quick and easy way to get a list of all the named pipes?
8 Answers
In the Windows Powershell console, type
[System.IO.Directory]::GetFiles("\\.\\pipe\\")
If your OS version is greater than Windows 7, you can also type
get-childitem \\.\pipe\
This returns a list of objects. If you want the name only:
(get-childitem \\.\pipe\).FullName
In Powershell 7, the second example \\.\pipe\
does not work (see this known bug), so you will have to stick to the first syntax.

- 44,254
- 30
- 139
- 205
-
3You may want to consider opening Powershell as an administrator – dotNetE Aug 27 '13 at 22:57
-
2You can also use get-childitem \\.\pipe\ – Chris Gillum Jan 22 '15 at 22:15
-
@ChrisGillum I tried that, and got an error "Cannot find path '\\.\pipe\' because it does not exist" – Andrew Shepherd Jan 22 '15 at 23:50
-
1@AndrewShepherd Interesting. What OS are you running on? It works for me on Windows Server 2012 and Windows 10 (PowerShell v3 and v5 respectively). – Chris Gillum Jan 23 '15 at 01:10
-
@ChrisGillum I'm testing it on Windows 7, Powershell v2. – Andrew Shepherd Jan 23 '15 at 01:43
-
1@ChrisGillum But I just tried it on my Windows Surface RT device. It works there. (Powershell v4). I'll incorporate your comment into the answer. – Andrew Shepherd Jan 23 '15 at 01:46
-
Actually, I updated my Windows 7 machine to use Powershell 5. The second example still does not work on Windows 7. Where it works or not must depend on the OS, not the powershell version. – Andrew Shepherd Dec 10 '17 at 22:44
-
5On Windows 10 (20H2), somehow the get-childitem variant works on Powershell 5 but not Powershell 7. – Chih-Hsuan Yen Dec 31 '20 at 06:06
-
2@Chih-HsuanYen - [It's a bug](https://github.com/PowerShell/PowerShell/issues/11898). This is the workaround: `[System.IO.Directory]::EnumerateFiles('\\.\pipe\')` – Granger May 06 '22 at 19:56
You can view these with Process Explorer from sysinternals. Use the "Find -> Find Handle or DLL..." option and enter the pattern "\Device\NamedPipe\". It will show you which processes have which pipes open.

- 1,960
- 18
- 28

- 46,588
- 15
- 99
- 136
-
Check which version of Process Explorer you have before you try this. It does not work on v15.23, but works on v16.02. (haven't tried other versions) – Carl Jul 06 '14 at 21:56
-
2To avoid possible exceptions - as it is mentioned in other answers - you can use my solution which is more low level but working like a charm even if named pipe's name contains invalid characters in way of name of file. Please see http://stackoverflow.com/questions/25109491/how-can-i-get-a-list-of-all-open-named-pipes-in-windows-and-avoiding-possible-ex/25126943#25126943 – user2126375 Aug 04 '14 at 20:26
-
4Using `pipelist.exe` from SysInternals is even simpler, but it's command line only. – Chris Charabaruk Mar 04 '18 at 02:29
Try the following instead:
String[] listOfPipes = System.IO.Directory.GetFiles(@"\\.\pipe\");

- 30,133
- 4
- 83
- 114

- 641
- 6
- 2
-
7your missing a slash. string[] listOfPipes = System.IO.Directory.GetFiles(@"\\.\pipe\"); – dmex Nov 25 '10 at 23:15
-
I spent all night looking for a function to search for or list pipes. This is exactly what I needed. Thanks!! – MushroomSoda Apr 23 '12 at 03:31
-
What is this special path? \\.\ seems to be used for raw access to a drive, but where does `pipe` come from? – Kevin Doyon Mar 02 '16 at 22:22
-
2@Kevin "\\.\" means "this machine" as per https://msdn.microsoft.com/en-US/en-en/library/windows/desktop/aa365783(v=vs.85).aspx – Eugene Ryabtsev Apr 29 '16 at 05:51
-
The best thing is, that also works in Powershell... `[System.IO.Directory]::GetFiles("\\.\pipe")` Thanks! – Poorkenny Sep 05 '16 at 15:27
-
5We have had issues with this method working on windows 10 - getting error "Second path fragment must not be a drive or UNC name. Parameter name: path2 " – Dai Bok Nov 23 '16 at 10:28
-
@DaiBok This is handled [here at SO](https://stackoverflow.com/q/25109491/806690). – tm1 Nov 22 '18 at 14:09
Use pipelist.exe from Sysinternals.

- 88,211
- 155
- 421
- 625

- 501
- 4
- 2
-
1See also handle.exe from sysinternals which will show almost all things that have an open handle. – JimR Jan 03 '11 at 22:55
I stumbled across a feature in Chrome that will list out all open named pipes by navigating to "file://.//pipe//"
Since I can't seem to find any reference to this and it has been very helpful to me, I thought I might share.

- 461
- 4
- 5
-
-
1This does list my pipes. Amazing! (note this will work because it works like a directory, as Andrew Shepherd's answer shows) – Martín Coll Feb 07 '17 at 19:55
-
I guess this is for debugging/diagnostics, since I noticed Chrome uses a *lot* of named pipes - I found *125* "chrome" pipes even when Chrome isn't running! – Cocowalla Jul 26 '20 at 21:06
-
-
Daynew, awesome! Thanks alot. @JayElston, doesn't work in Firefox :( Chrome only. – 1234ru Mar 08 '23 at 22:05
At CMD
prompt:
>ver
Microsoft Windows [Version 10.0.18362.476]
>dir \\.\pipe\\

- 1,307
- 12
- 15
C#:
String[] listOfPipes = System.IO.Directory.GetFiles(@"\\.\pipe\");

- 30,133
- 4
- 83
- 114

- 259
- 2
- 2
The second pipe was interpreted by this web site when submitted... You need two backslashes at the beginning. So make sure to use System.IO.Directory.GetFiles(@"\\.\pipe\")
.
Note that I have seen this function call throw an 'illegal characters in path.' exception when one of the pipes on my machine had invalid characters. PipleList.exe worked ok though, so it seems like a bug in MS's .NET code.

- 9,878
- 7
- 49
- 66

- 101
- 1
- 2
-
1The note about 'illegal characters in path' is an important point, because it is very common for programs to open pipe names that trigger this. Any program that opens a pipe named like `C:\myLocation\someFile.x` will cause this error. – dss539 Jul 30 '13 at 14:13