首页 > 系统相关 >关于 Powershell 的管道的坑

关于 Powershell 的管道的坑

时间:2023-02-17 14:23:57浏览次数:35  
标签:输出 aaa PS PowerShell 管道 关于 Powershell

PowerShell 允许在管道中包含本机外部命令。 但是,请务必注意,PowerShell 的管道面向对象,不支持原始字节数据。

管道或重定向输出原始字节数据的本机程序的输出会将输出转换为 .NET 字符串。 此转换可能会导致原始数据输出损坏。

解决方法是使用 cmd.exe /csh -c 调用本机命令,并使用 | 本机 shell 提供的 和 > 运算符。

例子:
PS > "aaa" | openssl enc -base64
YWFhDQo=
PS > "aaa" | ConvertTo-Base64
YWFh

 

标签:输出,aaa,PS,PowerShell,管道,关于,Powershell
From: https://www.cnblogs.com/yinyue200/p/17129951.html

相关文章