I am trying to echo the VALUE of a variable whose name contains another variable ($project!$project_number!_control) while using delayed expansion. I can't figure out the syntax to do this. Here's the code:
@echo off setlocal enabledelayedexpansion set $loop_counter= for %%g in (1,2,3,4,5,6,7,8) do ( set /a $loop_counter+=1 if !$loop_counter! gtr 4 ( echo. rem echo $loop_counter = !$loop_counter! set /a $project_number=!$loop_counter!-4 echo $project_number = !$project_number! set $project!$project_number!_control=Project Description # !$loop_counter! echo $project!$project_number!_control = !$project!$project_number!_control! ) ) echo. pause echo. set echo. pause The line of code I'm having the problem with is the last line in the for loop:
echo $project!$project_number!_control = !$project!$project_number!_control! Specifically, it's the code to the right of the equal sign that echoes the VALUE of the $project!$project_number!_control variable that I'm having trouble with. The set command (that is run after the pause command in the code above) clearly shows that the values "Project Description #5," "Project Description #6," "Project Description #7," and "Project Description #8" were assigned correctly to the corresponding project1_control, project2_control, project3_control, and project4_control, variables.
Can someone please tell me what syntax to use to display the VALUE of the $project!$project_number!_control variable?
Thanks In Advance For The Help!