Monday, March 14, 2011

Obtain a Character from a String - DOS Batch File


SET WORDTEMP=RandomWord

REM Get the first character of the word
ECHO WORDCHAR=%WORDTEMP:~0,1%

REM Get the 2nd character of the word
ECHO WORDCHAR=%WORDTEMP:~1,1%

REM Get the first two letters of the word
ECHO WORDCHAR=%WORDTEMP:~0,2%


No comments:

Post a Comment