Add File Command Option

Command Syntax

/AddFile  <target_folder_path>
          <source_file_path>
          [-overwrite {default|always|no}]
          [-overwrite no -cond <no_overwrite_condition>]

Adds a file to the project.

Parameters:

  • <target_folder_path>
  • The target project folder.
  • <source_file_path>
  • The source file's path.
  • [-overwrite default]
  • If the file from the package is newer, it overwrites the one from the target machine at install time. This happens only in case there's a file with the same name in the same location on the target machine. This is the Windows Installer default.
  • [-overwrite always]
  • Always installs the file.
  • [-overwrite no]
  • Prevents overwriting the existing file with the same name from the target machine if there is one in the same install location.
  • [-overwrite no -cond <no_overwrite_condition>]
  • Prevents the existing file to be overwritten if the condition is met.

NoteThe -overwrite parameter variations can be used only in MSI-based project types.

NoteIf the added file already exists in the project, then its attributes will be updated with the current specified ones.

Example:

AdvancedInstaller.com /edit MyProject.aip
    /AddFile APPDIR C:\File.txt

This installed file will be overwritten with the file from the package only if the condition is false:

AdvancedInstaller.com /edit MyProject.aip
    /AddFile APPDIR C:\File.txt -overwrite no -cond "MY_PROP=1"

For WinCE projects:

AdvancedInstaller.com /edit MyProject.aip
    /AddFile %InstallDir% C:\File.txt