Clarification of nested IF and FOR statements
Posted: 04 Jul 2021 12:49
Hello!
I'm reading the book "The personal trainer: Windows command line".
It says that I need to use @ symbol to begin nested IF statement.
They also do the same with FOR statement:
I saw many examples on the Internet, where nested IF and FOR statements are used without @ symbol.
Do I need to use @ symbol to begin nested IF or FOR statement?
What is the difference between using @ symbol and not using it?
Thanks!
I'm reading the book "The personal trainer: Windows command line".
It says that I need to use @ symbol to begin nested IF statement.
Use @ symbol to designate the start of the nested if statement.
Code: Select all
if "%1"=="1" (
@if "%2"=="2" (hostname & ver) else (ver)
) else (
hostname & ver & netstat -a
)
Code: Select all
for /d %%B in (%APPDATA% %APPDATA%\*) do (
@for %%C in ("%%B\*.txt") do (echo %%C)
)
Do I need to use @ symbol to begin nested IF or FOR statement?
What is the difference between using @ symbol and not using it?
Thanks!