在Windows中,什么是2℃之间的差;&放大器1和2 - ;&放大器; 1? [英] In Windows, what's the difference between 2<&1 and 2>&1?

查看:129
本文介绍了在Windows中,什么是2℃之间的差;&放大器1和2 - ;&放大器; 1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

本页面的例子和解释离开我困惑:

The examples and explanations in this page are leaving me confused:

<一个href=\"http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/redirection.mspx?mfr=true\">http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/redirection.mspx?mfr=true

有没有使用2℃之间的任何实际差别;放大器&; 1和2>&安培; 1?第二种形式(2>&安培; 1)。是我熟悉的,从与Unix外壳工作

Is there any practical difference between using 2<&1 and 2>&1? The second form (2>&1) is familiar to me, from working with the Unix shell.

以上链接的页面有:

要找到FILE.TXT,然后重定向处理1(即STDOUT)和手柄2(即STDERR)到Search.txt,类型:结果
  findfile file.txt的> search.txt 2';&放大器; 1

To find File.txt, and then redirect handle 1 (that is, STDOUT) and handle 2 (that is, STDERR) to the Search.txt, type:
findfile file.txt>search.txt 2<&1

和也

要重定向所有的输出,包括手柄2(即STDERR),从ipconfig命令来处理1(即STDOUT),然后重定向输出中以Output.log,类型:结果
  IPCONFIG.EXE >> output.log 2>&安培; 1

To redirect all of the output, including handle 2 (that is, STDERR), from the ipconfig command to handle 1 (that is, STDOUT), and then redirect the ouput to Output.log, type:
ipconfig.exe>>output.log 2>&1

在最后,是那里的结果有什么区别?

In the end, is there any difference in the results?

推荐答案

一些例子应该显示会发生什么:

Some examples should show what happens:

c:\YourDir> cd FolderNotHere > nul
The system cannot find the path specified. 

您得到错误流

c:\YourDir>cd FolderNotHere > nul  2>&1

您得到什么,错误流去肚里为null STD输出流。

You get nothing, the error stream goes to the std output stream which goes to null.

c:\YourDir>cd > nul

您得到什么,输出流去空。

You get nothing, the output stream goes to null.

c:\YourDir>cd > nul 1>&2
c:\YourDir

您获得已发送到错误流,因此它不会被重定向性病outout。

You get the std outout which has been sent to the error stream so it doesn't get redirected.

c:\YourDir>cd > nul 1<&2

这个接缝做一样的1>和2

This seams to do the same as 1>&2

这篇关于在Windows中,什么是2℃之间的差;&放大器1和2 - ;&放大器; 1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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