是否可以在 Windows 中发现命名管道?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3789576/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 15:18:28  来源:igfitidea点击:

Is it possible to discover named pipes in Windows?

windowsnamed-pipes

提问by Jader Dias

Is there any method or tool that list existing named pipes in a Windows box?

是否有任何方法或工具可以在 Windows 框中列出现有的命名管道?

回答by Brian

The sysinternals tool, pipelist, is designed to list the existing named pipes.

sysinternals 工具pipelist旨在列出现有的命名管道。

回答by Omar Elsherif

C#:

C#:

String[] listOfPipes = System.IO.Directory.GetFiles(@"\\.\pipe\");

String[] listOfPipes = System.IO.Directory.GetFiles(@"\\.\pipe\");

edit: Warning!

编辑:警告!

This approach may fail and throw an exception if any existing pipe name contains characters that are illegal for use in file names. Pipe names are less restrictive than file names, so it is possible that some pipe may have a strange name and cause this exception.

如果任何现有管道名称包含在文件名中使用非法的字符,则此方法可能会失败并引发异常。管道名的限制比文件名要少,因此有可能某些管道的名称很奇怪并导致此异常。