Posted: 5 years ago

Filed under: Sysadmin

Tagged with:

Follow comments

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.

Comments

  1. Miksu Says:

    A good thing that someone knew this. I used it to set up a task running every hour, in a sort of easy way.

Leave a Reply