windows 如何在一行中执行多个命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13719174/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to execute multiple commands in a single line
提问by zdd
I know Unix has the following command which can execute multiple commands in a single line, how can I do this in DOS?
我知道 Unix 有以下命令可以在一行中执行多个命令,我如何在 DOS 中执行此操作?
command1 ; command2 ; command3 ...
回答by SidR
Googling gives me this:
谷歌搜索给了我这个:
Command A & Command B
Command A & Command B
Execute Command A, then execute Command B(no evaluation of anything)
执行命令 A,然后执行命令 B(不评估任何东西)
Command A | Command B
Command A | Command B
Execute Command A, and redirect all its output into the input of Command B
执行命令 A,并将其所有输出重定向到命令 B的输入
Command A && 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
执行命令 A,运行后评估错误级别,如果退出代码(错误级别)为 0,则才执行命令 B
Command A || 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
执行命令 A,评估此命令的退出代码,如果它不是 0,则只执行命令 B