Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Blank lines and labels (that is, lines starting with : or ::) cannot be used consecutively at the same time inside ()
View 1,331 Replies 6
Credits 1,916 Posts 752 Joined 2008-12-28 04:30 17-year member UID 135147 Gender Male From 广西
Status Offline
:labels, when placed inside compound code blocks, are inherently meaningless to batch files,
so it should be normal that they can't run;
if they can run, that would instead be a bug in cmd
Credits 1,039 Posts 897 Joined 2009-03-01 15:34 17-year member UID 140302 Gender Male From 在地狱中仰望天堂
Status Offline
Originally posted by netbenton at 2009-9-3 02:08:
: Labels, when placed inside a compound block, are inherently meaningless to batch files,
so it's normal if they can't run; if they can run, then that's actually a bug in cmd
But without a blank line, it can run.
It's just that labels and blank lines can't be used inside () at the same time; used separately, either one still works.
Besides, the command-line syntax doesn't specify anything like that either.
[ Last edited by Hanyeguxing on 2009-9-3 at 02:49 ]
Credits 2,278 Posts 1,020 Joined 2007-11-19 13:34 18-year member UID 103127 Gender Male
Status Offline
I've been working with batch files for ages, but actually there are still a lot of things about cmd preprocessing that I don't dare dig into deeply, just like pointers and memory management in C; subconsciously I always avoid them...
But it's exactly these so-called “bugs” that make cmd more interesting in an invisible way. If used properly, they can achieve a lot of strange functions. Just like malformed directories, we're happy to accept them too.