Batch Files

Joined
Mar 5, 2004
Messages
1,736
Reaction score
123
Hi All,

I was wondering, I used to write batch files when I used to work on computers with DOS 6.22 etc. I've forgotten how to do it. How could I write a batch file that can be executed by clicking on an icon in windows?

The reason I ask, is that my dad is pretty poor with computers. He's got a Sony Vaio laptop and has just bought a Canon digital SLR camera and he has photos EVERYWHERE! He always claims that they've moved from where he put the etc. haha.

What I would like to do is create a batch file which will back up his whole my docs picture folder or something similar so it's easy for him to make sure stuff is backed up.

Thanks.
 

Ian

Administrator
Joined
Feb 23, 2002
Messages
19,873
Reaction score
1,499
It's probably easier to download something like Comodo Backup (free!) and then schedule it to backup a folder automatically : http://backup.comodo.com/

However, if you did want to make a batch file, just create a file somewhere called backup.bat (or whatever you want) and then right click it and click edit.

You'll then need to think how you want to backup the files (i.e., perhaps zip them up or just copy them?). The example just copies them to a backup drive and creates a log file:

Code:
@echo off
xcopy "C:\Users\Dad\Pictures\*.*" d:\PicBackup\ /c /s /r /d /y /i > d:\PicBackup\xcopy.log
  • /d—This switch copies all source files that are newer than existing destination files. It allows you to update only files that have changed, making the process a lot faster.
  • /c—This command-line option ignores errors. You don’t want one corrupted file to halt the automated copying.
  • /s—This option copies directories and subdirectories.
  • /r—This switch copies read-only files.
  • /y—Use this switch to overwrite files without prompting. You don't want any user intervention to be required.
  • /i—Use this option to automatically create new folders on destination.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top