Powershell sshd命令不同

问题描述 投票:0回答:1

我在Windows Server 2019 https://github.com/PowerShell/Win32-OpenSSH上安装了OpenSSH

SSH很好用,除了Powershell SSH中的管道(|)命令有问题。我已经成功转换了一些|命令;例如:

powershell  Mount-VHD -Path D:/VMdir/tester.vhdx -PassThru | Get-Disk | Get-Partition | Get-Volume

成为

powershell  Mount-VHD -Path D:/VMdir/tester.vhdx -PassThru; Get-Disk; Get-Partition; Get-Volume

而且效果很好,但我也有:

powershell (Get-VM tester | select-object MemoryMaximum).memorymaximum/1mb

而且我无法在SSH中使用此工具,尽管不能通过SSH在Windows中正常工作,我已经尝试了;和&,但不起作用。首先,为什么管道命令可以在Windows内而不是通过ssh在Windows外部运行,以及为什么我可以在上述命令中替换管道以使其通过ssh正常运行?上面的命令仅显示一个数字(例如2048),不显示任何其他信息,因此我只需要一个数字。

powershell ssh openssh windows-server-2016 windows-server-2019
1个回答
0
投票

使用“ |”代替|完美地工作。

© www.soinside.com 2019 - 2024. All rights reserved.