''

问题描述 投票:37回答:3

我正在使用PowerShell并尝试运行以下命令:

.\test_cfdp.exe < test.full | tee test.log

test.full是一个模拟test_cfdp.exe命令行输入的脚本。但是,我收到以下错误:

The '<' operator is reserved for future use.

有没有其他方法(即cmdlet)我可以用来使这个命令在PowerShell中工作?

powershell redirect io-redirection
3个回答
39
投票

这个was not supported in PowerShell v1 [和v5一样,它仍然不是......]

一个示例解决方法是:

Get-Content test.full | .\test_cfdp.exe | tee test.log

19
投票

还试试:

cmd /c '.\test_cfdp.exe < test.full | tee test.log'

0
投票

如果要多次运行此命令,可以使用原始语法创建* .bat文件。那是另一种解决方案。

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