Home > Commands A-M > Commands M

MV


Description | Syntax | Parameters | Switches | Related | Notes | Examples | Errorlevels | Availability

Move File - Copy a file to another location even if the file is in use (Locked).


Syntax

MV [/x] [/d] Source Destination


Parameters
Destination (NT4)
File destination. Note that you must use a FULL pathname.
Source (NT4)
File to be copied. Note that you must use a FULL pathname.

Switches
/d (NT4)
Does not copy the file until reboot time allows in-use files to be replaced. Not available in the posix version.
/x (NT4)
Prevents the default action that will otherwise create a folder called "deleted" containing a copy of the original file.

Related

INUSE - updated file replacement utility.
COPY - Copy one or more files to another location.
MOVE - Move a file from one folder to another.
Equivalent Linux BASH commands:
mv - Move or rename files or directories.


Notes

The NT resource kit contains 2 versions of MV.EXE - a posix version and a Windows NT version - they are not the same!

You can do a file replace at boot time by manually updating the registry (which is what MV.exe does).

  1. Start the registry editor (regedt32.exe not regedit.exe)
  2. Move to HKLM\SYSTEM\CurrentControlSet\Control\Session Manager
  3. Double click on PendingFileRenameOperations (if it does not exist - create of type multi_str )
  4. On the first line is the name of the new file with \??\ in front, e.g. \??\d:\temp\ntfs.sys
  5. On the second line is the file to replaced with !\??\ in front, e.g. !\??\c:\winnt\system32\drivers\ntfs.sys
  6. Click OK.

So the complete Multi-String Data would appear like:

\??\d:\temp\ntfs.sys
!\??\c:\winnt\system32\drivers\ntfs.sys

Once the reboot is complete and the file replaced the PendingFileRenameOperations value will be deleted from the registry.


Examples
    MV /x /d d:\temp\ntfs.sys C:\winnt\system32\drivers\ntfs.sys

Errorlevels

none.


Availability
External Resource Kit
DOS
none
Windows
none
Windows NT
NT4