We can do this using DOS also
Please run this in loop. Once please enter the condition once we get EOF. like 01\'0\' or null or \" \" etc. I do not know exactly what to use for batch.
Please complete or correct my codes.set /p pass=<string.txt
echo %pass%
:st
call set new=%%pass:~%a%,1%%
echo a=%a% + 1
echo %a%
Thanks and regards
vishu
C:test>type viscnt.bat
@echo off
set /a a=2
echo Here is a string > string.txt
set /p pass=<string.txt
echo pass=%pass%
REM :st is label or a point in the code
REM where we jump to or return to
call :st %a%
echo return from :st
rem we may use call to jump to or return to a location
rem ( a label ) in the code or to rem another batch file
rem set new=%%pass:~%a%,1%% I do not know what this does
set new=%pass:~%a%,1%
echo new=%new%
rem set assigns a value to a variable.
rem A variable is a location in RAM where the value is stored
set /a a=%a% + 1
echo a=%a%
goto :end
:st %a%
echo a=%1
echo We are at the :st label location
echo a=%1
exit /b
:end
Output:
C:test>viscnt.bat
pass=Here is a string
a=2
We are at the :st label location
a=2
return from :st
new=Here is a string a
a=3