如何在一行中执行多个命令 [英] How to execute multiple commands in a single line
问题描述
我知道Unix有以下命令可以在一行执行多个命令,我该如何在DOS?
command1; command2; command3 ...
Googling给了我: p>
命令B 执行命令A ,然后执行命令B (没有任何评估)
命令B
执行命令A ,并将其所有输出重定向到 >命令B
命令A&命令B 执行命令A ,在运行后评估错误级别,如果退出代码errorlevel)为0,则只能执行命令B
命令A ||命令B
执行命令A ,评估此命令的退出代码,但为0,则只能执行命令B
I know Unix has the following command which can execute multiple commands in a single line, how can I do this in DOS?
command1 ; command2 ; command3 ...
Googling gives me this:
Command A & Command B
Execute Command A, then execute Command B (no evaluation of anything)
Command A | Command B
Execute Command A, and redirect all its output into the input of Command B
Command A && Command B
Execute Command A, evaluate the errorlevel after running and if the exit code (errorlevel) is 0, only then execute Command B
Command A || Command B
Execute Command A, evaluate the exit code of this command and if it's anything but 0, only then execute Command B
这篇关于如何在一行中执行多个命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!