一个简单的问题:是否可以使用.net应用程序的输出并将其通过Powershell通过Out-GridView传递?
比如说我有一个C#控制台应用程序,它执行以下操作:
Console.WriteLine("col1-value \t col2-value \t col3-value");
Console.WriteLine("col1-value \t col2-value \t col3-value");
是否可以将输出管道传输到Out-GridView并将所有内容分隔在不同的命名列中?否则它将如何工作?
将您的C#程序的输出重定向到一个文件中:
csharp.exe > $env:temp\foo.txt
然后使用类似这样的脚本来读取文件的内容并将其显示在Grid-Window中:
$Columns = "Col1", "Col2", "Col3"
Get-Content $env:temp\foo.txt | ConvertFrom-Csv -Header $Columns -Delimiter "`t" | Out-GridView
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句