Page 1 of 1

Substring by Variale

Posted: 14 Nov 2013 07:46
by Yossi Moses
Dear freinds
The following is very tivial:

Code: Select all

%PATH:~10,5%
(from SET command help)
I don't have the 10 and 5 as constants but in Vars, so, I try this and of course it doesn't work
(Where x is for the 10 and y is for the 5)

Code: Select all

%PATH:~%x%,%y%%

Thank you very much for Suggestions

Re: Substring by Variale

Posted: 14 Nov 2013 08:19
by ShadowThief

Code: Select all

setlocal enabledelayedexpansion

!PATH:~%x%,%y%!

Re: Substring by Variale

Posted: 14 Nov 2013 08:36
by dbenham
Or, in the rare instances when delayed expansion cannot be used:

Code: Select all

call echo %%path:~%x%,%y%%%


Dave Benham