Skip to main content

Batch Script Moving Files

Moving Files

In Batch Script, you can move files with the move command.

Syntax
move [/Y | /-Y] [drive:][path]filename1[,...] destination

The following are the possible options for the move command:

NameDescription
[drive:][path]filename1Specifies the location and name of the file or files you want to move
destinationSpecifies the new location of the file. Destination can consist of a drive letter and colon, a directory name, or a combination. 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]dirname1Specifies the directory you want to rename.
dirname2Specifies the new name of the directory.
/YSuppresses prompting to confirm you want to overwrite an existing destination file.
/-YCauses prompting to confirm you want to overwrite an existing destination file.

Examples

The following command moves the c:\windows\temp files to the root temp directory.

move c:\windows\temp\*.* c:\temp

The following command moves the files new.txt and test.txt to the c:\example folder.

move new.txt, test.txt c:\example

Table of Contents