defect122

windows batch - if statements connect variables

Mar 24th, 2012
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. Connecting terms in if statements with ; (semicolon) ( "" is important)
  2.  
  3. @echo off
  4. set /a a=1+1
  5. set /a b=1-1
  6.  
  7. if "%a%;%b%"=="2;2" ( echo Error
  8. ) else ( echo %a% equals 2 but %b% does not equal 2 )
  9. pause>nul
  10. exit
Advertisement
Add Comment
Please, Sign In to add comment