I持って次のスクリプト:私は2>&1
が何であるかについて興味2>&1は、PowerShellの
if($timeout -ne $null)
{
& $var$timeout 2>&1 > $logDir\$logName
}
else
{
& $var2>&1 > $logDir\$logName
}
。またはそれが表すもの私はそれが何と呼ばれているのか分からない、そうでなければ、私はそれを調べるだろう。
I持って次のスクリプト:私は2>&1
が何であるかについて興味2>&1は、PowerShellの
if($timeout -ne $null)
{
& $var$timeout 2>&1 > $logDir\$logName
}
else
{
& $var2>&1 > $logDir\$logName
}
。またはそれが表すもの私はそれが何と呼ばれているのか分からない、そうでなければ、私はそれを調べるだろう。
それは標準出力(1)と同じ場所に標準誤差(2)をリダイレクトする
ドキュメントはあなたの友達です。 PS> man about_Redirection
The Windows PowerShell redirection operators are as follows.
Operator Description Example
-------- ---------------------- ------------------------------
<snip>
2>&1 Sends errors (2) and Get-Process none, Powershell 2>&1
success output (1)
to the success
output stream.
<snip>
The syntax of the redirection operators is as follows:
<input> <operator> [<path>\]<file>
If the specified file already exists, the redirection operators that do not
append data (> and n>) overwrite the current contents of the file without
warning. However, if the file is a read-only, hidden, or system file, the
redirection fails. The append redirection operators (>> and n>>) do not
write to a read-only file, but they append content to a system or hidden
file.
答えをありがとう、私は私の記事で言ったように、私はそれが何であるかわからない場合、どのように私は何かを検索することができます。それがリダイレクトであることが分かっていれば、私はあなたの答えを使用することができ、投稿する必要はありませんでした。 – BlackHatSamurai
ヘルプシステムをワイルドカードで検索できます。 'Get-Help '*&1 *' 'は上記のトピックを指します。 – latkin
私は知らなかった。ありがとうございました :) – BlackHatSamurai
可能重複から[シェルで、 "2>&1" は何ですか?](http://stackoverflow.com/questions/818255/in-the-shell-what-is-21) – x0n
'2>&1'は私のIOリダイレクトのように見えますが、私はpowershellをよく知っているわけではありません。 –
@ x0nはWindowsに適用される回答ですか?私にとってUnixのように見えます。何か違いはありますか? – BlackHatSamurai