I have a directory %appdata%\lootbot\locations
where there might be any number of files, each of which contain a single directory path. this code creates a list of those (unknown) files and the paths within and a choice prompt, along with a number to be used by choice
for selecting them.
set "count=0"
for %%s in ("%appdata%\lootbot\locations\*") do set /p locale=<"%%~s" & set "dirname=%%~s" & call :recall
set "choices="
if defined string1 echo %string1% & set "choices=1"
if defined string2 echo %string2% & set "choices=12"
if defined string3 echo %string3% & set "choices=123"
if defined string4 echo %string4% & set "choices=1234"
if defined string5 echo %string5% & set "choices=12345"
if defined string6 echo %string6% & set "choices=123456"
if defined string7 echo %string7% & set "choices=1234567"
if defined string8 echo %string8% & set "choices=12345678"
if defined string9 echo %string9% & set "choices=123456789"
if not defined choices echo too many & pause & exit /b
choice /c %choices%q /n /m "select the saved directory number you want to re-enter or Q to quit: "
echo errorlevel %errorlevel%
exit /b
:recall
set /a "count+=1"
set "string%count%=%count%: %dirname% (%locale%)"
the problem is that I can't figure out how to proceed after the choice prompt. I have the errorlevel
but I need to connect that to the correct %dirname%
so I can proceed. all my ideas come down to putting variables within variables, resulting in too many %
... I can't wrap my mind around this.