I am trying to create a batch script which will convert letters to numbers. But I cannot get it to be case sensitive - any suggestion?
@ECHO OFF
setlocal
set init="A=1" "a=2" "B=3" "b=4" "C=5" "c=6"
set %init: =&set %
set "nickname= "
set /P "nickname=Enter here: "
set "nickname=%nickname: =%"
if not defined nickname goto :EOF
set "out="
set "nums="
set "sum=0"
:loop
set "char=%nickname:~0,1%"
set "out=%out%%char%"
set /A "code=%char%, sum+=code"
set "nums=%nums%%code%"
set "nickname=%nickname:~1%"
IF DEFINED nickname GOTO :loop
ECHO original: %out%
ECHO converted to: %nums%
pause
So if I enter Aa it converts to 22 - but should be 12. Thanks! :)
I have searched and tried different solutions to similar problems found on stackoverflow. But no luck so far. If I enter Aa it converts to 22 - but should be 12.