if "%OS%"=="Windows_NT" @setlocal
...
if "%OS%"=="Windows_NT" @endlocal
Does the above basically mean this:
if(OS == 'Windows_NT'):
...
endif
?
What’s setlocal for ?
How do bat identify the endif?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
try
on command prompt
As for
ifstatements:help ifshould show you everything you need to know. Batch files have only single lineifstatements of the formsHowever, [statement] can be a block, delimited by parentheses:
There is no explicit
end ifkeyword. The end of theifstatement is marked by the end of the line or by the end of the parenthesized block.Also keep in mind that you need to be careful with setting and subsequently using environment variables in a single block. Read up in
help seton delayed expansion for the pitfalls there.