开发者

dos batch : using double quotes with IF

开发者 https://www.devze.com 2023-01-17 14:03 出处:网络
I have a DOS-batch like this : @echo off if \"%开发者_JAVA技巧1\" == \"%2\" GOTO next echo different

I have a DOS-batch like this :

@echo off
if "%开发者_JAVA技巧1" == "%2" GOTO next
echo different
goto end
:next
echo same
:end

Are the double quotes surrounding %1 and %2 necessary ? In which case are they useful ?


You need an expression before and one after the ==. If %1 or %2 is empty than you would get an syntax error.

0

精彩评论

暂无评论...
验证码 换一张
取 消