Solved Outputting variable name instead of first string

March 2, 2013 at 12:29:27
Specs: Windows 7
I'm trying to echo the first character of a given string but instead of displaying 1 when i input 123 it displays choice:~0,1.
Anyway here's my code:
@echo off & setlocal enabledelayedexpansion
cls & color 0A
set cnt=-1
set choice=?
set /P choice=Enter the string:
set /A cnt+=1
echo.!choice:~%cnt%,1!
pause > nul
exit /b


See More: Outputting variable name instead of first string

Report •

#1
March 2, 2013 at 12:42:44
✔ Best Answer
echo !choice:~%cnt%,1!

Can you spot the difference?

How To Ask Questions The Smart Way


Report •

#2
March 2, 2013 at 12:55:45
LOL, thanks. Wish i spotted that earlier.

Report •
Related Solutions


Ask Question