InstallShield 2016 » InstallScript Language Reference
The EzBatchAddString function adds a line of text to 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.
Caution • The EzBatchAddString function can fail if the default batch file is hidden or read-only.
EzBatchAddString 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
EzBatchAddString ( szLine, szRefKey, nOptions );
Parameters
Parameter |
Description |
|||||||||||||||
szLine |
Specifies the line of text to add to the file. Unless you specify NOSET in nOptions, this function assumes that szLine is an environment variable; the text "SET" is inserted at the front of the string before szLine is written to the default batch file. Caution • The EzBatchAddString function does not support long file names. If you are using this function to add a line that contains a long path, call LongPathToShortPath to convert the long path to its short path equivalent before adding it to the string to be placed in the batch file. For an explanation of long file names, see Long File Names. |
|||||||||||||||
szRefKey |
Specifies the reference key relative to which you want to add szLine in the default batch file. EzBatchAddString searches the default batch file for the reference key and places the contents of szLine before or after that line, depending on the value of nOptions. Note • EzBatchAddString looks for the appropriate reference keyword in the parameter szRefKey. For example, the keyword for an environment variable is the name of the environment variable itself. |
|||||||||||||||
nOptions |
Specifies the option to use. Pass one of the following predefined constants in this parameter:
The NOSET and COMMAND constants can be combined with each other or the BEFORE, AFTER, or REPLACE constants using the logical OR operator. For example, 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 the constant AFTER, as shown below: EzBatchAddString (szLine, szRefKey, AFTER | COMMAND); |
Return Values
Return Value |
Description |
0 |
EzBatchAddString successfully added the text string to the specified batch file. |
< 0 |
EzBatchAddString was unable to add the text string. |
See Also
InstallShield 2016 Help LibraryMay 2017 |
Copyright Information | Flexera Software |