BatchMoveEx

InstallShield 2018 » InstallScript Language Reference

The BatchMoveEx function moves the line specified by szMove from one location to another in a batch file. The parameter nOptions specifies whether to position the line at the beginning or end of the batch file, or before or after the line specified by szRefKey.

Note • Before calling BatchMoveEx, you must call BatchFileLoad to load the file to be modified into memory. After you modify the file, call BatchFileSave to save it to disk.

Do not mix the Ez batch file functions with the advanced batch file functions. After calling BatchFileLoad, you cannot use Ez batch file functions until you have called BatchFileSave to save the file.

Syntax

BatchMoveEx ( szMove, szRefKey, nOptions, nMoveOption );

Parameters

BatchMoveEx Parameters

Parameter

Description

szMove

Specifies the reference key that identifies the line to be moved.

szRefKey

Specifies the key that identifies the reference line used to position the line being moved. If szRefKey is a null string (“”), the line specified by szMove is moved to the beginning or end of the file, depending on the value of nOptions.

nOptions

Specifies where to move the line. Pass one of the following predefined constants in this parameter:

BEFORE—The line specified by szMove is moved before the line containing the reference key in szRefKey. If szRefKey is a null string (“”), the line specified by szMove is moved to the beginning of the file.
AFTER—The line specified by szMove is moved after the line containing the reference key in szRefKey. If szRefKey is a null string (“”), the line specified by szMove is moved to the end of the file.

When the reference key you are searching for is a DOS command or program name (not an environment variable), use the OR operator to combine the constant COMMAND with BEFORE or AFTER, as shown below:

BatchMoveEx (“PATH”, “SCAN.EXE”, BEFORE | COMMAND, 0);

nMoveOption

Specifies whether szMove is a command or an environment variable. Pass one of the following predefined constants in this parameter:

0—Specifies that szMove is an environment variable.
COMMAND—Specifies that szMove is a command.

Return Values

BatchMoveEx Return Values

Return Value

Description

0

BatchMoveEx successfully moved the specified line in the batch file.

< 0

BatchMoveEx was unable to move the line in the batch file.

See Also