Command Reference

Install File

Installs a file on the local system. Essentially this performs a copy command with more options.

Action ID: 52
Action Category: File Operations

Settings

Locations

Source

The path and filename of the file to install.

Destination

The destination directory and/or filename.

Note: The destination directory MUST already exist when performing this action. If Destination specifies a path to a file, all of the folders included in the path must already exist. You can use a Create Directory action to create a destination directory if necessary.

Options

If file already exists

The action that will be taken if a file with the same name already exists at the destination. The relative newness of the file is determined by the version resource information built into the file. If the file does not contain version information, the file’s date and time will be used as criteria. The options are:

Action

Description

Overwrite if existing file is same or older (Default)

If the file that we are installing is newer than or the same as the existing file, then overwrite the existing file.

Overwrite if existing file is older

If the file that we are installing is newer than the existing file, then overwrite the existing file.

Always overwrite existing file

The file that we are installing will always overwrite an existing file with the same name.

Never overwrite existing file

The file that we are installing will never overwrite an existing file with the same name.

Ask the user

The user will be asked whether or not the existing file should be overwritten.

NOTE: It is generally not a good idea to select "Always overwrite existing file" unless you are sure that this is what you need to do. Also, do not select "Ask the user" unless you are sure they have the knowledge to make such a decision. "Overwrite if existing file is same or older" is generally the safest option for this situation.

Create Backup

If selected, a backup of the existing file (if any) will be made during installation. The existing file will be renamed to filename.bak. If filename.bak already exists, it will be named filename.bk1, or filename.bk2, etc. The new file will only be installed after the existing one has been backed up.

Shared/System file

If checked, a usage count will be kept for the file during installation and uninstallation. This feature should only be used for files that are shared by multiple programs, such as system files.

Return Values

Value
(%LastErrorNum%)

Simple Message
(%LastErrorMsg%)

Verbose Message
(%LastErrorDetails%)

0 (OK)

 OK

 

1

Failed to install file.

File not found.
<<Source>>

2

Failed to install file.

Invalid destination specified.
<<Destination>>

3

Failed to install file.

Invalid source specified.
<<Source>>

4

Failed to install file.

Could not delete file(s)
<<Destination>>

5

Failed to install file.

Could not copy file(s)
<<Source>>
<<Destination>>

Example

In this example, we will install a file called "MyControl.dll" from the "download" subdirectory to the user's system directory.

Source: %SrcDir%\download\MyControl.dll
Destination: %SysDir%
If file already exists: Overwrite if existing file is same or older
Create Backup: Unchecked
Shared/System file: Checked

 

See Also: Alphabetical List of Actions, Categorical List of Actions, On Error tab