PowerShell 中的 2>&1 是什么意思 [英] What does 2>&1 Mean in PowerShell

查看:47
本文介绍了PowerShell 中的 2>&1 是什么意思的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下脚本:

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

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

I'm curious about what 2>&1 is; or, what it represents. I don't know what it's called, otherwise, I'd look it up.

推荐答案

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

It redirects standard error (the 2) to the same place as standard output (the 1)

这篇关于PowerShell 中的 2>&1 是什么意思的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆