windows - Batch setting REM as variable to make code look different -
lately started comment lines double :: , i'm aware of problems can make in long "for" or "choice" scripts , issues "goto" described what :: (double colon) mean in dos batch files?
so i'm wondering if it's ok set variable rem , use it?
i've seen somewhere in little cmd script, , liked it, since making batch code looks clearer me. wonder if wont create problems?
@echo off set #=rem %#% show date echo it's %date% %#% let's wait few seconds... ping 1.1.1.1 > nul echo , it's %date% %#% whatever exit
that no problem, what-so-ever.
the variable serving macro, , use technique (though not remarks). batch parser expands code within variable prior interpretation of logic of code, functions hope/expect.
there sophisticated technique create batch macros take arguments. post @ http://www.dostips.com/forum/viewtopic.php?f=3&t=2518 describes ultimate syntax, , http://www.dostips.com/forum/viewtopic.php?t=1827 shows development of technique on time.
your use of %#%
rem
macro valid, , there no 1 "best" style. prefer use :: comment
remarks not within parenthesized blocks, , %= comment =%
remarks within parenthesized blocks. last syntax undefined variable gets expanded nothing. there few dynamic pseudo variables contain =
in name, , impossible batch variable contain 2 =
in name. technique safe use long comment not contain :
or %
.
Comments
Post a Comment