Update File Command Option

Command Syntax

/UpdateFile <target_file_path>
            [<source_file_path>]
            [-get_source_name]
            [-name <file_name>]
            [-overwrite {default|always|no}]
            [-overwrite no -cond <no_overwrite_condition>]

Updates a file to the project.

Parameters:

  • <target_file_path>
  • The target file you need to update in the setup project.
  • [<source_file_path>]
  • The source file's path.
  • [-get_source_name]
  • The updated file in the project is renamed to its source file name. It cannot be used alongside the -name switch.
  • [-name <file_name>]
  • Specifies the updated file name. It cannot be used alongside the --get_source_name switch.
  • [-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.

Example:

The "APPDIR\File.txt" file from the project gets updated to a new source file.

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

The "APPDIR\File.txt" file is renamed to "NewFile.txt".

AdvancedInstaller.com /edit MyProject.aip
    /UpdateFile APPDIR\File.txt -name NewFile.txt

For WinCE projects:

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