FileInstall

Extracts a file embedded into the compiled script via #App { Files: [...] }, or copies it when it is not embedded.

FileInstall Source, Dest , Overwrite

Parameters

Source

Type: String

The embedded file's relative path exactly as listed in #App { Files: [...] }, with either / or \ separators, compared case-insensitively. When Source matches no embedded file, the call behaves like FileCopy instead. In source mode, a relative Source resolves against A_ScriptDir and names the live file on disk.

Unlike AutoHotkey, Source may be any expression.

Dest

Type: String

The name of the file to be created. It is assumed to be in A_WorkingDir if an absolute path isn't specified. The destination directory must already exist.

Overwrite

Type: Integer

If omitted, it defaults to 0. Otherwise, specify one of the following numbers to indicate whether to overwrite files if they already exist:

0: Do not overwrite existing files. The operation will fail and have no effect if Dest already exists.

1: Overwrite existing files.

Other values are reserved for future use.

Error Handling

An exception is thrown on failure.

Any case where the file cannot be written to the destination is considered failure. For example:

Remarks

When Source is copied rather than extracted, no action is taken if the full source and destination paths are equal.

Embedded files are neither compressed nor encrypted.

#App, FileCopy, #Include

Examples

Embeds a text file into the compiled version of the script. When the script runs, the file is extracted to another location with another name. If a file with this name already exists at this location, it will be overwritten.

#App {
    Files: ["My File.txt"],
}
FileInstall "My File.txt", A_Desktop "\Example File.txt", 1