• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 326
  • Last Modified:

Batch Files

How to create a batch file to move files from one location to another?
1 Solution
Create an empty (text) file, rename is to filename.bat
Right-click on file en choose 'edit'

paste a string like this to copy a file:

copy C:\test.txt  D:\test.txt

Is this what you need?
You may need to go to My Computer >  Tools > Folder Options > View
Uncheck "Hide extensions for known file types"

Now you can rename the text file.

If you want to use it to do a backup the xcopy command is fairly useful

type in something like

Now create a blank text file (right click > new > New Empty Text File)

Rename it to copy.bat

then type the follwing in the file - replacing the path ie c:\ with where you want to copy from & to
xcopy "c:\test" "d:\test" /d /s /c /y

This will copy all the files in a directory to a new one, it will also copy all the files that have changed since the last time you ran the command (incremental backup) it will keep copying if errors occur - files that are in use and it will overwrite the destination without prompting

This method just makes things easy

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now