Posted by Valerie on July 01, 2011 at 05:50:41:
In Reply to: Re: Multiple variables within dos substring extraction posted by Valerie on June 24, 2011 at 04:33:11:
Original script:
?C:\> type trial.bat
@echo off
cls
setlocal enabledelayedexpansion
set variable=12345
set y=3
set z=1
set X=!variable:~%y%,-%z%!
echo X = %X%
?C:\>
=================================================
After executing with Echo On, Win XP Home:
?C:\> setlocal enabledelayedexpansion
?C:\> set variable=12345
?C:\> set y=3
?C:\> set z=1
?C:\> set X=!variable:~3,-1!
?C:\> echo X = 4
X = 4
?C:\>
=================================================
After executing with Echo Off:
X = 4
←C:\>