move (command)
In computing, move
is a command in various command-line interpreters (shells) such as COMMAND.COM
, cmd.exe
, 4DOS/4NT, and PowerShell. It is used to move one or more files or directories from one place to another. The original file is deleted, and the new file may have the same or a different name. The command is analogous to the Unix mv
command and to the OpenVOS move_file
and move_dir
commands.
Implementations
The command is available in DOS, IBM OS/2, Microsoft Windows and ReactOS. On MS-DOS, the command is available in versions 6 and later. In Windows PowerShell, move
is a predefined command alias for the Move-Item
Cmdlet which basically serves the same purpose. The FreeDOS version was developed by Joe Cosentino. DR DOS 6.0 includes an implementation of the move
command. The open-source MS-DOS emulator DOSBox has no MOVE
command. Instead, the REN
command can be used to move files.
Syntax
To move one or more files:
MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination
To rename a directory:
MOVE [/Y | /-Y] [drive:][path]dirname1 [destination\]dirname2
To move a directory:
MOVE [/Y | /-Y] [drive:][path]dirname1 destination
Parameters
- [drive:][path]filename1: Specifies the location and name of the file or files you want to move.
- destination: Specifies the new location of the file or directory. Destination can consist of a drive letter and colon, a directory name, or a combination, and must already exist. If you are moving only one file, you can also include a filename if you want to rename the file when you move it.
- [drive:][path]dirname1: Specifies the directory you want to rename or move.
- dirname2: Specifies the new name of the directory.
- /Y: Suppresses prompting to confirm you want to overwrite an existing destination file.
- /-Y: Causes prompting to confirm you want to overwrite an existing destination file.
The switch /Y may be present in the COPYCMD environment variable. This may be overridden with /-Y on the command line. Default is to prompt on overwrites unless MOVE command is being executed from within a batch script.
Notes
- When moving a directory, dirname1 and its contents wind up as a subfolder beneath destination. Caution is advised - if the final subfolder of the destination path does not exist, dirname1 will be both moved and renamed.
See also
References
Further reading
- Wolverton, Van (1990). MS-DOS Commands: Microsoft Quick Reference, 4th Revised edition. Microsoft Press. ISBN 978-1556152894.
- Kathy Ivens; Brian Proffit (1993). OS/2 Inside & Out. Osborne McGraw-Hill. ISBN 978-0078818714.
- Frisch, Æleen (2001). Windows 2000 Commands Pocket Reference. O'Reilly. ISBN 978-0-596-00148-3.