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
Post a Comment