Tuesday, July 10, 2012

DOS batch string manipulation

http://www.dostips.com/DtTipsStringManipulation.php

And there's also command processor batch file variable manipulation, similar to BASIC language string functions. Check the link for more examples. Who knew?!

Left$(envvar,5)=%envvar:~0,5%
Right$(envvar,5)=%envvar,~-5,5%
Mid$(envvar,3,2)=%envvar,~3,2%
Repl(envvar,"old","new")=%envvar:old=new%
(Remove envvar first 2 chars and last 3 chars) = %envvar:~2,-3%


No comments:

Post a Comment