10

Can anyone please tell me how to move a folder from one path to another path using batch script?

For example, I want to move XXX folder (including the contents) from D:\abc\XXX folder to D:\cef\.

Costique
  • 23,712
  • 4
  • 76
  • 79
orbit
  • 101
  • 2
  • 2
  • 6

2 Answers2

21

How about the plain old-fashioned:

move d:\abc\XXX d:\cef\XXX
Carl Norum
  • 219,201
  • 40
  • 422
  • 469
3

An example of solution is:

MOVE "%SystemDrive%\folder" "%UserProfile%\Desktop"

The move is only allowed if the source and destination drive are the same. If the destination folder does not exist then the folder "folder" will be renamed with the name of the destination folder. Example:

MOVE "%UserProfile%\Desktop\folder" "%UserProfile%\Desktop\folder1"

("Folder1" does not yet exist)

An example of illegal syntax for rename the folder is:

MOVE "%SystemDrive%\folder" "%UserProfile%\Desktop\folder1"

("Folder1" does not yet exist)