Dynamic substrings of SET command in batch-file -
i want batch-file testing substrings of set command, %var:~5,3%
see below:
@echo off setlocal enabledelayedexpansion set var=abcdefghijklmnopqrstuvwxyz echo. echo string: abcdefghijklmnopqrstuvwxyz echo. echo samples of substrings: echo ~5,3 : %var:~5,3% echo.~5 : %var:~5% echo.~0,-2 : %var:~0,-2% echo. echo.test more: (type 000 exit command prompt) :loop set /p "substr=~" echo.!var:~%substr%! echo. if %substr%==000 exit goto:loop
output input's user : ~5
fghijklmnopqrstuvwxyz
and output input's user : ~5,2
var:~5,2
what solution?
thnx.
:loop set /p "substr=~" if "%substr%"=="000" exit echo(!var:~%substr%! echo( goto loop
Comments
Post a Comment