代码之家  ›  专栏  ›  技术社区  ›  George Sovetov

在Windows和CMD中,如何(以及为了什么)使用流句柄3到9?

  •  0
  • George Sovetov  · 技术社区  · 6 年前

    在CMD文档中 https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-xp/bb490982(v=technet.10) 是从3到9的手柄。

    文件内容如下:

    这些句柄由应用程序单独定义,并且特定于每个工具。

    它们都是默认打开的吗?或者我必须从脚本或程序中打开它们?我怎么用它们 ReadFile WriteFile ?

    1 回复  |  直到 6 年前
        1
  •  2
  •   user6811411 user6811411    6 年前

    如链接所述:

    Handle    Numeric equivalent  Description
              of handle                      
    ========= =================== =======================================
    STDIN         0               Keyboard input
    
    STDOUT        1               Output to the Command Prompt window
    
    STDERR        2               Error output to the Command Prompt window
    
    UNDEFINED     3-9             These handles are defined individually
                                  by the application and are specific to 
                                  each tool.
    

    请参阅以下参考资料:
    https://stackoverflow.com/a/28864990/6811411
    Combining multiple text files into one
    http://www.dostips.com/forum/viewtopic.php?f=3&t=3126