Batch File Redirection

Redirection

CommandsDescription
command > fileWrite standard output of command to file
command 1> fileWrite standard output of command to file (same as previous)
command 2> fileWrite standard error of command to file (OS/2 and NT)
command > file 2>&1Write both standard output and standard error of command to file (OS/2 and NT)
command >> fileAppend standard output of command to file
command 1>> fileAppend standard output of command to file (same as previous)
command 2>> fileAppend standard error of command to file (OS/2 and NT)
command >> file 2>&1Append both standard output and standard error of command to file (OS/2 and NT)
commandA | commandBRedirect standard output of commandA to standard input of commandB
commandA 2>&1 | commandBRedirect standard output and standard error of commandA to standard input of commandB (OS/2 and NT)
command < filecommand gets standard input from file
command 2>&1command’s standard error is redirected to standard output (OS/2 and NT)
command 1>&2command’s standard output is redirected to standard error (OS/2 and NT)


Notes:
  (1) Where the table mentions redirection to a file you may also use redirection to a device. Redirection from a device is not always possible.
  (2) Redirection to the NUL device is often used to hide standard output, instead of displaying it on screen:
    COPY *.* A: > NUL
  Another frequently used redirection is redirection to a parallel port to print standard output:
    DIR > LPT1

For details, please go to http://www.robvanderwoude.com/redirection.php

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值