Skip to content

Batch Script Moving Files

Learn how to use the move command in Windows Batch Script to relocate files between directories, including syntax, options like /Y for overwrite suppression, and practical examples for renaming and bulk file transfers.

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

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

The following are the possible options for the move command:

Name Description
[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. 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]dirname1 Specifies the directory you want to rename.
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.

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
Navigation