batch script to fix for me -


this code echo every line number of character , character not right. try fix. main thing variable count must stay instead of %%m. please explain me row call!!!

and how make last row show last character of input word.

@echo off  :input set /p word=input word: if not defined word goto input (echo %word%)> tempfile.txt  %%x in (tempfile.txt) ( set /a lenght=%%~zx - 2 ) del tempfile.txt echo %word% got %lenght% characters  setlocal enabledelayedexpansion /l %%m in (1,1,!lenght!) (     set /a count=0     set /a count=count+%%m     call echo !count! %%word:~!count!,1%% )  endlocal  pause 

so, here output:

input word:qwertzuio qwertzuio got 9 characters 1 w 2 e 3 r 4 t 5 z 6 u 7 8 o 9  press key continue... 

when echoing character, using !count! index, count starting @ 1, whereas need start indexing @ 0.

try this:

for /l %%m in (1,1,!lenght!) (     set /a count=%%m     set /a index=%%m-1     call echo !count! %%word:~!index!,1%% )  

i'm setting index %%m-1 starts @ 0, leaving count 1-based. (i got rid of set /a count=0 serving no purpose.)

here's sample output:

input word:foo foo got 3 characters 1 f 2 o 3 o press key continue . . . 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -