Command Prompt for Windows

Command LBFIND


Search a list box for a string beginning with the characters in the specified string. The index of the string found is stored in an environment variable called LBFIND.


LBFIND dlg_id id start "string"
dlg_idSpecifies the identifier of the dialog box that contains the list box.
idSpecifies the identifier of the list box.
startSpecifies the index of the string preceding the first string to be searched.
stringSpecifies a sequence of characters that contains the prefix to search for.


Indexes are zero based, that is, the first string in the list box is at index 0, the second string is at index 1 and so on.

The search is not case sensitive.

When the search reaches the bottom of the list, it continues from the top of the list, back to the index specified by parameter start. If parameter start is -1 then the entire list is searched from the beginning.

When the list box does not contain the specified string then a value of -1 is returned.

Also see command LBTEXT.