I'm new to this level of programing so forgive me if any of this is stupid. I'm trying to write a batch file that reads from a spread sheet and does something based on an input.
I already got it reading and doing with:
for /f "skip=1 delims=, tokens=1,2,3,4,5,6,7,8,9,10,11,12,12" %%g in (users1.csv) do set choice=%%p
IF %choice% ==ONE GOTO ONE
IF %choice% ==TWO GOTO TWO
IF %choice% ==THREE GOTO THREE
Where %%p is a colum in the spreadsheet and chice is just a variable. However i want to change it so rather than entering this choice on the spreadsheet they are propted for it. i.e.
Press A for One
Press B for Two
Enter A or B
I started by putting :
for /f "skip=1 delims=, tokens=1,2,3,4,5,6,7,8,9,10,11,12,12" %%g in (users1.csv) do CHOICE /C:abc
IF ERRORLEVEL ==2 GOTO TWO
IF ERRORLEVEL ==1 GOTO ONE
This worked for the first row on the spreadhseet but i can't get it to work for the following rows. I get the prmpts to enter abc... for the number of rows but this dosn't translate into jumping to the code section, running the code and then repeating for the next row.
Hope thats clear, if you need anything else let me know. Full code bellow and spreadsheet is a csv file of peoples details.
@ECHO OFF
:BEGIN
CLS
ECHO Enter Letter for site:
ECHO a for one
ECHO b for two
ECHO c for thre
for /f "skip=1 delims=, tokens=1,2,3,4,5,6,7,8,9,10,11,12,12" %%g in (users1.csv)do (ECHO %%g
for /f "skip=1 delims=, tokens=1,2,3,4,5,6,7,8,9,10,11,12,12" %%g in (users1.csv) do CHOICE /C:abcdefghijklmno
IF ERRORLEVEL ==3 GOTO THREE
IF ERRORLEVEL ==2 GOTO TWO
IF ERRORLEVEL ==1 GOTO ONE
GOTO END
:THREE
ECHO YOU HAVE PRESSED three
GOTO END
:TWO
ECHO YOU HAVE PRESSED two
ECHO %%g
GOTO END
:ONE
ECHO YOU HAVE PRESSED ONE
GOTO END
:END