Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想出了一种在 .bat 脚本中编写 if 条件的方法:
if %sample==1( echo "successful" )
但是我该如何添加其他条件呢?
很简单。
if %sample==1( echo "successful" ) else ( echo "unsuccessful" )
顺便说一句,如果您要比较字符串,%则两边都需要 ( %sample%)。
%
%sample%
if %sample==1( echo "successful" ) ELSE ( echo "failed" )