Thanks Nate. It works.
But now i need output variable for this script to use later.
There are 2 outputs i need. First is count variable as integer output, second is string variable which is equal to last string character in "word".
So, i need this 2 variable as you see in last row of finished script before "press any key to continue...".
1 last integer variable and 1 last string variable.
I need these 2 variables for later scripting in this script.
How i can have it?
Here is a script which works from yesterday.
@ECHO OFF
:input
set /p word=input your word:
if not defined word goto input
(ECHO %word%)> tempfile.txt
FOR %%x IN (tempfile.txt) DO ( SET /A lenght=%%~zx - 2 )
del tempfile.txt
echo %word% got %lenght% characters
setlocal enabledelayedexpansion
for /l %%m in (1,1,!lenght!) do (
set /a count=%%m
set /a index=%%m-1
call echo !count! %%word:~!index!,1%%
)
(call echo %%word:~!index!,1%%)>tf.txt
for /f "tokens=*" %%a in (tf.txt) do (
set line=%%a
set char=!line:~0,1!
)
pause
echo %count% %char%
endlocal
pause