How to extract characters from a string
Posted: 28 Apr 2011 20:23
Below is a sample dos batch file. I managed to compute the starting position (posn) to extract the character. But the set command unable to extract the characters form the string. Can a variable (%posn%) be used in the set Command?
set today=%date%
set mth=%today:~4,2%
set mths=janfebmaraprmayjunjulaugsepoctnovdec
SET /A posn=100%mth%%%100*3-3
set mmm=%mths:~%posn%,3%
Thanks in advance.
set today=%date%
set mth=%today:~4,2%
set mths=janfebmaraprmayjunjulaugsepoctnovdec
SET /A posn=100%mth%%%100*3-3
set mmm=%mths:~%posn%,3%
Thanks in advance.