EzBatchReplace

InstallShield 2016 » InstallScript Language Reference

The EzBatchReplace function replaces an existing line of text in the default batch file; unless it is changed by a call to BatchSetFileName, the default batch file is the Autoexec.bat file that was executed by the system during the boot sequence. To determine the fully qualified name of the default batch file, call BatchGetFileName. To change the name of the batch file to be used by EzBatchAddPath, call BatchSetFileName.

Some common keys in a batch file are PATH, COMSPEC, TEMP, Smartdrv.exe, Win.com, and Share.exe.

Caution • The EzBatchReplace function may fail if the default batch file is hidden or read-only.

EzBatchReplace does not make a backup copy of the file it modifies.

Note • Do not mix Ez batch file functions and advanced batch file functions. After calling BatchFileLoad to load a batch file in memory, you cannot call any of the Ez batch file functions until you call BatchFileSave to save the file.

Syntax

EzBatchReplace ( szNewString );

Parameters

EzBatchReplace Parameters

Parameter

Description

szNewString

Specifies the new string to insert in place of an existing line in the file. EzBatchReplace parses szNewString and determines the key of the string. It then searches the default batch file for a line that contains the same key. The function replaces the last line found with the same key.

Caution • The EzBatchReplace function does not support long file names. If you are using this function to replace a line that contains a long path, call LongPathToShortPath to convert the long path to its short path equivalent before replacing it in the string in the batch file. For an explanation of long file names, see Long File Names.

Return Values

EzBatchReplace Return Values

Return Value

Description

0

EzBatchReplace successfully replaced the line of text.

< 0

EzBatchReplace was unable to replace the line of text.

See Also