📄 redir.doc
字号:
redir
*****
DOS, in its many flavors and versions, lacks a decent I/O redirection
mechanism. Sure, it's got < and > and >>, but what about error
messages? Lots of people ask, "How do you send those error messages to
a file?" Well, you use a program like `redir'.
`redir' is basically a program that manipulates the standard file
descriptors by copying them, closing and opening them, etc. Once it
has the file descriptors where it wants them, it runs your program,
which inherits the changed descriptors. Thus, `redir' has nearly
complete control over the input and output of your program.
It also allows you to view the exit code of the program, and the
elapsed time of the program, by supplying the appropriate options on
the command line.
Note that `redir' is built with command-line expansion and response
files disabled, so as to allow the application to control that
themselves. This means that you can't use those features to provide
`redir''s options or the command name, but if you use them for the
command's options, the command will do the expansion if it wants to.
The exit code of `redir' is 1 if it exits on its own accord, else it
returns the same error code as the program it runs.
Usage: `redir' [`-i' FILE] [`-o' FILE] [`-oa' FILE] [`-e' FILE] [`-ea'
FILE] [`-eo'] [`-oe'] [`-x'] [`-t'] COMMAND [ARGS . . .]
`-i FILE'
Redirect stdandard input from file
`-o FILE'
Redirect standard output to file
`-oa FILE'
Append standard output to file
`-e FILE'
Redirect standard error to file
`-ea FILE'
Append standard error to file
`-eo'
Redirect standard error to standard output
`-oe'
Redirect standard output to standard error
`-x'
Print the exit code of the command after it exits. If the exit
code is 0..255, it is printed as is. If it is not, the low byte
(0..255) is printed in decimal and the whole value is also printed
in hex.
`-t'
Print elapsed time, either in seconds (for short runs) or
hours:minutes:seconds.
Options are processed in the order they are encountered. Thus, "-o foo
-eo" means "redirect output to foo, then redirect errors there also",
whereas "-eo -o foo" means "send errors to where output was going, then
move output to foo".
Examples:
To redirect errors to a file:
redir -e errors.lst command ...
To redirect output to a file, and errors through a pipe:
redir -eo -o prog.out command ... | pipe
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -