Home › Forums › Great Computer Tips And Tricks › What is??? How to??? › What is a batch file and how do you make a simple one? › Re: How to make a batch file to backup your files?
This is my favorite batch file but the commands in all batch files vary, depending on what Operating system you are using. In this example I will show you how to backup files with Windows XP and Windows Vista.This is so simple and so much fun.How to make a batch file to backup files in Windows XPIf you typed the following into a notepad file and saved it as yourfilename.bat it would not work because you need to put your file paths in there. This is one of those cases where we will need to know how to find a file path. The paths you have to change are in italic writing.xcopy "C:Documents and SettingsYour usernameMy DocumentsMy Pictures" "H:backup of pictures" /e /yThis command will backup my pictures on C: drive and paste it to H: drive in a folder called backup of pictures. If you put the destination as just H: than all the files will be all over the place. You must specify a folder. I usually make a new folder first. Of course you can also get the batch file to make the new folder for you but this is another article altogether. /e means to copy all directories and sub directories/y means to copy with prompting to overwrite the already exsisting filesNow in this simple batch file you could do so many things:You could add more paths and backup more files. You can make it so it only backs up one folder only or one file.How to make a batch file to backup files in Windows VistaNow to do the same thing in Windows Vista we just need to change the xcopy command to robocopy. So this is what it will look like. (but remember to put your own paths in there)robocopy "C:Documents and SettingsYour usernameMy DocumentsMy Pictures" "H:backup of pictures" /e /yType this text, with your own details, into a notepad and save as a .bat file and thats it.