星期五, 四月 21, 2006

XP 命令行符号

Syntax : Redirection

   command  >  filename       Redirect command output to a file

command >> filename APPEND into a file

command < filename Type a text file and pass the text to command

commandA | commandB Pipe the output from commandA into commandB

command & command Perform the first command & then perform the second

command 2> filename Redirect any error message into a file

command 2> nul Redirect any error message to NUL

(command) 2> filename Redirect any CMD error into a file

command > fileA 2> fileB Redirect output and errors to separate files

command > file 2> nul Redirect output to a file and suppress any error

(command) > file 2> nul Redirect output to a file and suppress any CMD error

command > file 2>&1 Redirect output and errors to one file

command 2>&1 >filename This will fail!