what does "delims=" mean?

A

AAaron123

for /f "delims=" %%a in ('dir /B *.sql') do call :subr "%%a"
In the above, what does "delims=" mean?I understand "delims=/" but not
"delims="Also, can "do" executed two commands?Thanks
 
V

VanguardLH

AAaron123 said:
for /f "delims=" %%a in ('dir /B *.sql') do call :subr "%%a"

My guess is you are ensuring that the default parsing characters of
space and tab are used. You aren't specifying delimiters for the items
added the output list specifying by the filespec for the 'in' operator.
Doesn't seem any point in specifying a null string because the result is
to use the default delimiters.
Also, can "do" executed two commands?

Separate the commands with & or &&.

& = do next command even if prior command errors.
&& = do next command only if prior command does not error.

Example (using your for-loop):

for /f %%a in ('dir /B *.sql') do echo Processing %%a & call :subr "%%a"

In this case, it doesn't make a difference in using & or &&. But in:

for /f %%a in ('dir /B *.sql') do ren "%%a" "%%a.tmp" && call :subr "%%a"

it will only do the call if the rename worked. There are other
conditional operators for multiple commands. Read:

http://www.microsoft.com/resources/...docs/en-us/ntcmds_shelloverview.mspx?mfr=true
 
A

AAaron123

I saw the following.
Is that another way of executing two commands?

....snip... do (
echo Checking and possibly decompressing "%%a"
compact /u /i /a "%%a"
)

Thanks for the Command shell overview link.
If I had seen that before I'm sure I wouldn't have known it applied to the
command in the for command.

As I understand it you think it would work the same without "delims=". Yes?

Thanks a lot
 
A

AAaron123

I had googled before I posted and didn't find the meaning of "delims="
although I did see usages of it.

Did you actually see that with the url you gave me?

As I now understand it, if I left it out I'd get the same result.

However, although it didn't address my question, the second google hit gave
an excellent elementary tutorial of the FOR /F command


Thanks
 
T

Twayne

AAaron123 said:
I saw the following.
Is that another way of executing two commands?

...snip... do (
echo Checking and possibly decompressing "%%a"
compact /u /i /a "%%a"
)

Thanks for the Command shell overview link.
If I had seen that before I'm sure I wouldn't have known it applied
to the command in the for command.

As I understand it you think it would work the same without
"delims=". Yes?
Thanks a lot

delims= removes the delimiters from memory.

If you're looking for batch help, XP's greatest place I know of is the
alt.msdos.batch.nt
group on any server still serving up the *.alt groups. I doubt you can
ask a question that would stump those guys<g>! Actual DOS or XP, either
one.

Twayne`
 
V

VanguardLH

AAaron123 said:
I saw the following.
Is that another way of executing two commands?

...snip... do (
echo Checking and possibly decompressing "%%a"
compact /u /i /a "%%a"
)

That is another way. It is grouping or blocking of command. You can do
it in the 'if' command, too.
As I understand it you think it would work the same without "delims=". Yes?

In a couple test cases, I saw no difference in the filespec output or in
parsing it to the replaceable parameter. It is possible that it would
have an effect when you nest multiple commands to, for example, have a
for-loop use the default delims instead of the one specified in a parent
for-loop. While you could use "delims= " to go back to using the space
character as a delimiter, specifying the default tab character could be
problematic in entering it into the delims string and users that read
the code seeing just a bunch of whitespace and not knowing what was
really there.
 
A

AAaron123

thanks a lot

VanguardLH said:
That is another way. It is grouping or blocking of command. You can do
it in the 'if' command, too.


In a couple test cases, I saw no difference in the filespec output or in
parsing it to the replaceable parameter. It is possible that it would
have an effect when you nest multiple commands to, for example, have a
for-loop use the default delims instead of the one specified in a parent
for-loop. While you could use "delims= " to go back to using the space
character as a delimiter, specifying the default tab character could be
problematic in entering it into the delims string and users that read
the code seeing just a bunch of whitespace and not knowing what was
really there.
 
A

AAaron123

Thanks a lot

Twayne said:
delims= removes the delimiters from memory.

If you're looking for batch help, XP's greatest place I know of is the
alt.msdos.batch.nt
group on any server still serving up the *.alt groups. I doubt you can
ask a question that would stump those guys<g>! Actual DOS or XP, either
one.

Twayne`
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top