gwin003
gwin003

Reputation: 7982

Concat Strings in a batch file

I am generating a Guid in a batch file, then I need to wrap that Guid in curly braces. How do I do that?

for /f %%i in ('"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\uuidgen.exe"') do set guid=%%i

ECHO %guid%
pause

set guid = "{"%guid%"}"
ECHO %guid%

My solution doesnt seem to work. Any ideas?

Upvotes: 0

Views: 166

Answers (1)

Joey
Joey

Reputation: 354844

set guid={%guid%}

As simple as that. Note that you shouldn't have spaces around the = (because your variable name would end in a space and its value would start with one) and quotes are included verbatim in the value unless you quote the complete argument to set by using set "foo=bar" but that isn't necessary here.

Upvotes: 2

Related Questions