How to read characters from a string inside a for loop in a batch file -


am trying read characters string inside loop, not getting result. code this

@echo off setlocal enableextensions enabledelayedexpansion set str="abcdefgh" /l %%x in (1,1,5) ( set fstr=!str:~1,%%x! echo %fstr% ) 

all time getting result "echo off". kindly how solve this

change

echo %fstr% 

to

echo !fstr! 

%fstr% shows value of fstr existed when line parsed, is, not set, so

echo %fstr% 

is interpreted as

echo 

hence echo reports echo status - echo off

echo !fstr! 

show value of fstr changed within loop (the run-time value).


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -