Replaces one file with another file, and creates a backup copy of the original file
_WinAPI_ReplaceFile ( $sReplacedFile, $sReplacementFile [, $sBackupFile = '' [, $iFlags = 0]] )
|$sReplacedFile||The name of the file to be replaced.|
|$sReplacementFile||The name of the file that will replace the $sReplacedFile file.|
|$sBackupFile||[optional] The name of the file that will serve as a backup copy of the $sReplacedFile file. If this
parameter is empty string, no backup file is created.
|$iFlags||[optional] The replacement options. This parameter can be one or more of the following values.
|Failure:||False (see remarks).|
If this function fails, call _WinAPI_GetLastError() function to get extended error information. The following
are possible error codes for this function.
The replacement file could not be renamed. If $sBackupFile was specified, the replaced and replacement files
retain their original file names. Otherwise, the replaced file no longer exists and the replacement file exists
under its original name.
The replacement file could not be moved. The replacement file still exists under its original name; however,
it has inherited the file streams and attributes from the file it is replacing. The file to be replaced still
exists with the name specified by $sReplacedFile.
The replaced file could not be deleted. The replaced and replacement files retain their original file names.
If any other error is returned, such as ERROR_INVALID_PARAMETER (87), the replaced and replacement files will
retain their original file names. In this scenario, a backup file does not exist and it is not guaranteed
that the replacement file will have inherited all of the attributes and streams of the replaced file.
Search ReplaceFile in MSDN Library.