MOVEFILE

This command moves an existing file.

17, [ErrorMode], [ExpandMode], SrcFilePath, [Expand], [DstFilePath], [Flags]

Parameters

  • ErrorMode
    Optional. Specified as a decimal representation of a hexadecimal bitmask. Values must be specified in decimal format. The following table shows the possible values.

    Value Name Description
    0 (0xnnnn0000) DAERH_ABORT Default. The abort-on-error mode stops the command file from processing further.
    32768 (0xnnnn8000) DAERH_IGNORE The ignore-on-error mode continues by processing the next command when an error occurs.
    32769-33023 (0x000080xx where xx!=00 is the number of retries) DAERH_RETRY_WITHIGNORE The retry-on-error with ignore mode retries the offending command up to 255 times. If the number of retries exceeds the retry count, this mode continues processing the next command.
    1-255(0x00xx where xx!=0 is the number of retries from 1-255) DAERH_RETRY_WITHABORT The retry-on-error with abort mode retries the offending command up to 255 times. If the number of retries exceeds the retry count, the command file processing halts.
    65536 – 4294901760(0xFFFFnnnn where FFFF is the delay mask in seconds) DAERH_DELAYMASK The delay error mode value is added to either the DAERH_RETRY_WITHIGNORE or the DAERH_RETRY_WITHABORT value to cause a delay between retries. This value is in seconds and has a range between 1 and 65535.

    Note   Parsing errors, especially the passing of not valid command parameters, generates an error in DAERH_ABORT error mode. With logging enabled, an appropriate error message is output to the log file.

  • ExpandMode
    Optional. Specifies if the string that follows it is an environment variable that should be expanded. Can occur multiple times with this command. The following table shows the possible values.

    Value Description
    0 Does not expand the string.
    1 Device Update Agent expands the string on the device.
    2 Device Update Agent script compiler expands the string on the development system.
  • SrcFilePath
    String that specifies the name of an existing file.

  • DstFilePath
    String that specifies the name of the new file. If Flags specifies 4 (MOVEFILE_DELAY_UNTIL_REBOOT), DstFilePath can be NULL. In this case, the file will be deleted when the system restarts. If SrcFilePath refers to a directory, the system removes the directory at restart only if the directory is empty.

  • Flags
    Optional. This parameter can be one or more of the values in the following table.

    Value Name Description
    1 DAMOVEFILE_REPLACE_EXISTING If a file named DstFilePath exists, the function replaces its contents with the contents of the SrcFilePath file. Cannot be used with directories.

    The translator does not validate that both DstFilePath and SrcFilePath specify files and not directories.

    2 DAMOVEFILE_COPY_ALLOWED If the file is to be moved to a different volume, MoveFile simulates the move by using the CopyFile and DeleteFile commands.

    This value cannot be used with DAMOVEFILE_DELAY_UNTIL_REBOOT.

    4 DAMOVEFILE_DELAY_UNTIL_REBOOT The system does not move the file until the OS restarts. The system moves the file immediately after AUTOCHK is executed, but before creating any paging files. Consequently, this parameter enables the function to delete paging files from previous startups. This value can be used only if the process is in the context of a user who belongs to the administrator group or the LocalSystem account.

    This value cannot be used with DAMOVEFILE_COPY_ALLOWED.

    8 DAMOVEFILE_WRITE_THROUGH Command does not return until the file has actually been moved on the disk. No effect when specified with DAMOVEFILE_DELAY_UNTIL_REBOOT.
    16 DAMOVEFILE_CREATE_HARDLINK Reserved for future use.
    32 DAMOVEFILE_FAIL_IF_NOT_TRACKABLE Fails if the source file is a link source, but the file cannot be tracked after the move. This situation can occur if the destination is a volume formatted with the FAT file system.

Remarks

For more information, see the Microsoft Windows SDK documentation at this Microsoft Web site.

Example

The following example shows typical use.

//
// MOVEFILE
//
MOVEFILE,,,c:\dua_temp\dua-log.txt,,c:\dua_temp\child\dua-log.txt

See Also

DUA Script Command Reference

Last updated on Wednesday, October 18, 2006

© 2006 Microsoft Corporation. All rights reserved.