powershell - 2>&1在PowerShell中是什么意思

标签 powershell

我有以下脚本:

if( $timeout -ne $null )
{
    & $var$timeout 2>&1 > $logDir\$logName
}
else
{
    & $var2>&1 >  $logDir\$logName
}

我很好奇2>&1是什么;或者,它代表什么。我不知道它叫什么,否则,我会查找它。

最佳答案

它将标准错误(2)重定向到与标准输出(1)相同的位置

关于powershell - 2>&1在PowerShell中是什么意思,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17931338/

相关文章:

powershell - 如何从Invoke-Pester获取失败的测试数量?

exception - PowerShell 运行时异常 - "could not load file or assembly"

powershell - 递归确定文件夹中所有扩展的 COUNT 和 SUM

powershell - 自动打开输出文件

json - ConvertTo-Json截断对象

git - 我应该如何在同一路径中对(某种)不相关的脚本进行版本控制?

arrays - 从 .NET 数组中删除元素 .remove 方法未按预期工作(Powershell)

linux - 是否可以避免在命令行中重复名称?

c# - Powershell 等效于 C# List with Coordinates

c# - 服务仅在调试时工作