2

In a cmd.exe script on Windows 7, I want to combine two variables to set a third.

Eg. (which doesn't work)

SET THIRD=%FIRST%%SECOND%

How can I do this ?


Apologies to everyone who even looked at this question. The example above works perfectly and I cannot reproduce the problem I was having. Thanks for pointing out my error.

2
  • Your example works for me. What OS? I used WinXP. Commented Nov 19, 2010 at 14:13
  • Can you provide a sample along with its output and how it differs from what you want? If you're trying to set a variable in a FOR loop, see my example here using SETLOCAL ENABLEDELAYEDEXPANSION. stackoverflow.com/questions/4209652/… Commented Nov 19, 2010 at 14:51

1 Answer 1

1

With quotes?

SET "THIRD=%FIRST%%SECOND%"
Sign up to request clarification or add additional context in comments.

1 Comment

Just to close this off, I have accepted your answer. I cannot reproduce the problem I was seeing. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.