|
Answer» Is there a way to assign a character like "a" a number like "1"? So that the USER can input a letter, the batch file will add a number and it will out put another letter that is equal to the two values added?
for EXAMPLE a=1 b=2 c=3
they input "a" and then the batch file adds two. So the batch file would output "c" because 1+2=3
ThanksTry this:
Code: [Select]echo off
set /P choice=input letter:
if %choice% EQU a set result=1 if %choice% EQU b set result=2 if %choice% EQU c set result=3 if %choice% EQU d set result=4 if %choice% EQU e set result=5 if %choice% EQU f set result=6 if %choice% EQU g set result=7 if %choice% EQU h set result=8 if %choice% EQU i set result=9
set /a result= %result%+2
if %result% EQU 1 set FINAL=a if %result% EQU 2 set final=b if %result% EQU 3 set final=c if %result% EQU 4 set final=d if %result% EQU 5 set final=e if %result% EQU 6 set final=f if %result% EQU 7 set final=g if %result% EQU 8 set final=h if %result% EQU 9 set final=i if %result% EQU 10 set final=j if %result% EQU 11 set final=k
echo %final% pause
Does this work out for you?Yes, thankyou. It really helped!
|