微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

bash – 只有在command1成功执行cmd windows shell时,才能运行command2

我们如何使用cmd shell语言组合命令,以便仅在第一个命令成功完成时才执行第二个命令?

像以下bash命令

make && ./a.out

a.out只有在make成功的情况下才能执行

下列
command1 && 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.

原文地址:https://www.jb51.cc/bash/387666.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐