我们如何使用cmd shell语言组合命令,以便仅在第一个命令成功完成时才执行第二个命令?
像以下bash命令
make && ./a.out
a.out只有在make成功的情况下才能执行
下列
原文链接:https://www.f2er.com/bash/387666.htmlcommand1 && command2
也应该在cmd上工作。报价从here:
When using cmd.exe,you can put multiple commands on the same line by using ‘&’ or ‘&&’ between commands. Using a single ampersand (&) will cause the first command and then the second command to be run in sequence. Using double ampersands (&&) introduces error checking. The second command will run only if the first command is successful.