Command Prompt for Windows




Command SUBSTR

Function:

Extract a section of text from a text string. The extracted text string is stored in an environment variable called SUBSTR.

Syntax:

SUBSTR pos size [text]
posPosition to start extracting text from, where the first character is at position 1, the second character is at position 2 and so on.
sizeNumber of characters to extract.
textSequence of characters.

Note:

Parameter pos can also be negative. The last character is at position -1, the second last character is -2 and so on.

Examples on using SUBSTR.

Also see command STRSPLIT, STRFIND, STRRFIND and Batch Files.