String Concat Problem in FOR ... DO

November 15, 2010 at 10:25:43
Specs: Windows XP
I have 3 text files in my directory. a.txt, b.txt and c.txt

When I run the following code

- - -

For %%X In ("*.TXT") Do (



- - -

I keep getting "-file:b.txt"

where I expect -file:a.txt -file:b.txt -file:c.txt

It seems there is an issue with the string concatenation?

thank you,


See More: String Concat Problem in FOR ... DO

Report •

November 15, 2010 at 12:15:37
You need to enable delayed expansion:

SETLOCAL EnableDelayedExpansion

Stick that at the top of your script.

NOTE: when using this, you need to use "!" instead of "%" for variable. (!TOTALPARAMETERS!)

Can I put a question here?

Report •

November 29, 2010 at 06:14:35
Hi Matt123,

thanks for the post. It also worked wonders for me.


Report •
Related Solutions

Ask Question