FileInstall

Includes the specified file inside the compiled script.

FileInstall, Source, Dest, Flag

 

Parameters

Source

The name of the file to be added to the compiled EXE. The file name must not contain double quotes, variable references (e.g. %ProgramFiles%), or wildcards. In addition, any special characters such as literal percent signs and commas must be escaped (just like in the parameters of all other commands).

In versions prior to 1.0.35.11, it is best to specify the file's absolute path and name. In later versions, the file is assumed to be in (or relative to) the script's own directory if an absolute path isn't specified.

Dest When Source is extracted from the EXE, this is the name of the file to be created. It is assumed to be in %A_WorkingDir% if an absolute path isn't specified. Unlike Source, variable references may be used.
Flag

(optional) this flag determines whether to overwrite files if they already exist:

0 = (default) do not overwrite existing files
1 = overwrite existing files

This parameter can be an expression, even one that evalutes to true or false (since true and false are stored internally as 1 and 0).

 

ErrorLevel

ErrorLevel is set to 1 if there was a problem or 0 otherwise.

 

Remarks

This command is a directive for the Ahk2Exe compiler that allows you to add extra files to the resulting compiled script. Later, when the compiled script is run, the files are extracted back out onto the disk.

The file Source is added during script compilation .  When the compiled script is executed and the same "FileInstall" command has been reached, the file is then extracted to Dest.

Files added to a script are compressed and also encrypted.

If this command is used in an normal (uncompiled) script, a simple file copy will be performed instead -- this helps the testing of scripts that will eventually be compiled.

 

Related

FileCopy, #Include

 

Example

FileInstall, C:\My Documents\My File.txt, %ProgramFiles%\My Application\Readme.txt, 1