Name

move

Synopsis

Move files and directories from one location to another.

Syntax

move [/y | /-y] filename[,...] destination
                  

Description

move works like copy, except that the source is deleted after the copy is complete. Filename can be a single file, a group of files (separated with commas), or a single file specification with wildcards.

The move options are:

filename

Specifythe location and name(s) of the file or files you want to move. Wildcards (*, ?) are supported.

destination

Specify the new location of the file. The destination parameter can consist of a drive, a directory name, or a combination of the two. When moving one file, destination may include a new name for the file.

/y

Suppress prompting to confirm creation of a directory or overwriting of the destination. This is the default when move is used in a batch file.

/-y

Cause prompting to confirm creation of a directory or overwriting of the destination. This is the default when move is used from the command line.

Examples

Move myfile.txt from the current directory to d:\files:

C:\>move myfile.txt d:\files\

Same, but rename the file to newfile.txt:

C:\>move myfile.txt d:\files\newfile.txt

Change the name of the directory d:\files to d:\myfiles:

D:\>move d:\files myfiles

Notes

copy, move, and xcopy will prompt you before overwriting an existing file, unless you specify a command line parameter instructing them to do otherwise. To change the default, set the copycmd environment variable to /y. To restore the default behavior, ...

Get Windows XP in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.