-1

I made this batch

@echo off
:U
set /a x=%x%+1
set /p var%x%=What is your data point (end to begin)
if %var%x%%==end (
SEt /a x=%x%-1
goto New
)
goto U
:next

Its only just begun and the main problem is something completely different (Im not gonna say IT so you won't answer it) as your probaly guessed I need a way to have a variable inside of a variable (I think its called nesting but I may be wrong)

  • This is usually done to manage a vector or array of values. See [this post](http://stackoverflow.com/questions/10166386/arrays-linked-lists-and-other-data-structures-in-cmd-exe-batch-script/10167990#10167990) – Aacini Apr 16 '12 at 22:16

1 Answers1

0

You need delayed expansion

@echo off
setlocal enableDelayedExpansion
:U
set /a x+=1
set /p var%x%=What is your data point (end to begin)
if !var%x%!==end (
  set /a x-=1
  goto New
)
goto U
:next

Note - I simplified your math expressions. Variables in SET /A expressions do not need to be enclosed in percents, and x+=1 is the same as x=x+1.

Your goto New does not match your :next label - Maybe a problem, maybe intentional.

dbenham
  • 127,446
  • 28
  • 251
  • 390