Substrings in bat files

Useful snippet of code for getting substrings in windows batch files:

Code:

SET VARIABLE=%OTHERVARIABLE:~index,length%

Example:

SET FIRSTNAME=%HELENNAME:~0,5%

Source: windows 2000 mailing list.

Posted on 27 Sep 04 by Helen Emerson (last updated on 27 Sep 04).
Filed under Sysadmin