0

In Windows system variable I have the following variable

x = 123 Data_123 = ddd:

How do I get this variable as a string from batch filet

So at the end I want to get the variable like "Data"_%x% and I will get the value ddd

How can I do that

1 Answer 1

1

you need delayed expansion:

@echo off
setlocal enabledelayedexpansion
set x=123
set data_123=hello
echo !data_%x%!

(there is another method without delayed expansion:

call echo %%data_%x%%%
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.