InstallShield 2016 » InstallScript Language Reference
The BatchAdd function inserts a SET command or other DOS command into a batch file that has been loaded into memory with BatchFileLoad. The parameter nOptions allows you to add the new command as the first or last statement in the file, replace an existing statement with the new command, or specify that the new command be added before or after an existing statement.
Before calling BatchAdd, 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
BatchAdd ( szKey, szValue, szRefKey, nOptions );
Parameters
Parameter |
Description |
|||||||||
szKey |
Specifies the keyword to add to the batch file. PATH, TEMP, and MYENV are examples of valid keys for this parameter. |
|||||||||
szValue |
Specifies the value of the key to be added to the batch file. This string must be no longer than 512 bytes; passing a string longer than 512 bytes will cause an installation error. To add a longer string, use the FileGrep and FileInsertLine functions. Caution • Batch files do not support long paths completely. 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 information on long paths and long file names, refer to Long File Name Format. |
|||||||||
szRefKey |
Specifies the reference key relative to which you are adding szKey in the batch file. |
|||||||||
nOptions |
Specifies where in the file to insert the line. Pass one of the following predefined constants in this parameter:
When the statement to be added is not a SET command, pass a null string ("") in szKey, pass the complete command in szValue, and use the OR operator to combine the constant COMMAND with one of the other option constants, as shown below: BatchAdd("", "PAUSE", "", COMMAND | AFTER); Note • BatchAdd automatically adds the DOS keyword SET to the beginning of the statement to be inserted unless you use the OR operator to combine the constant COMMAND with the value you pass in nOptions. If you do not explicitly specify REPLACE in nOptions, the specified statement is added even if a duplicate line exists in the batch file. |
Return Values
Return Value |
Description |
0 |
BatchAdd successfully added a SET statement or other command to the batch file. |
< 0 |
BatchAdd was unable to add the SET statement or other command to the batch file. |
Additional Information
An InstallScript reference key is either an environment variable, a DOS command, or a program file name. Environment variables are keywords such as PATH, COMSPEC, LIB, or other predefined or user-defined identifiers. The value of an environment variable is established by using the DOS SET command. Statements that appear in a batch file must be either DOS commands, program names (with or without command-line parameters), or comments. Refer to your operating system manual for a detailed definition of commands and environment variables.
See Also
InstallShield 2016 Help LibraryMay 2017 |
Copyright Information | Flexera Software |