Categories
Development

making a variable dynamic in if statement

I am trying to do the bellow:

setlocal enabledelayedexpansion
set choice=
set /p choice="Select File Number, or no to exit: "

if "%choice%"=="no" (
goto cleanup
) else (
set "!choice!=%choice%"
start %file!choice!%
pause
)

what i want is to open a file where the variable is %filex% and be able to choose what file to open

Leave an answer

Your email address will not be published. Required fields are marked *