Alex Rivera | Logout

How to concatenate strings in windows batch file for loop?

Asked 2013-07-19T10:21:22.757
75

I'm familiar with Unix shell scripting, but new to windows scripting.

I have a list of strings containing str1, str2, str3...str10. I want to do like this:

for string in string_list
do
  var = string+"xyz"
  svn co var
end

I do found some thread describing how to concatenate string in batch file. But it somehow doesn't work in for loop. So I'm still confusing about the batch syntax.

Edit
Report

1 Answer

66

Try this, with strings:

set "var=string1string2string3"

and with string variables:

set "var=%string1%%string2%%string3%"
answered 2013-07-19T10:30:13.123

Your Answer