Backup Windows Mail on Vista with xcopy

I know you can backup your email directly from within Windows Mail but this script saves me a few clicks and I can run it in a scheduled task so I can set it and forget it.

Download

For impatient you can download the batch file here.

Find Windows Mail Store Location

Open Windows Mail and open Tools/Options.

Click on the Advanced tab.

Click on Maintenance.

Click on Store Folder.

Copy the directory for your Mail Store. This is where all of your email is stored.

You can double check that you have the correct directory by pasting the copied directory above into an Explorer window. You should see files similar to the ones in the image below.

Configure Backup Location

Create a folder to store your Windows Mail backup. I have a second hard drive for all of my backups (I recommend you do the same) and I will use F:\Mail for the Mail backup folder.

You can also backup to your C:\ partition but it’s best that you have a second physical hard drive incase your main hard drive fails due to hardware issues.

Backup Script

Create a new batch file, I named mine backup_mail.bat and copy the following:

  1. Your source directory (the Store Location directory from above).
  2. And the destination backup folder.
  3. I will use my own directory structure for the example.
  4. Save the file once your are done editing.
xcopy /y /e "C:\Users\deffe\AppData\Local\Microsoft\Windows Mail\*" "F:\Mail\"

Windows Mail Cannot Be Running

Make sure that Windows Mail is no longer running. You can run the following command even after you have closed the application.

taskkill /IM WinMail.exe

(Optional) taskkill in Batch File

You can optionally combine the taskkill command with your xcopy command to gracefully close Windows Mail and start the backup.

taskkill /IM WinMail.exe
xcopy /y /e "C:\Users\deffe\AppData\Local\Microsoft\Windows Mail\*" "F:\Mail\"

(Optional) Restart Windows Mail after Backup

You can optionally restart Windows Mail after the backup is complete with the following command added to your batch file.

taskkill /IM WinMail.exe
xcopy /y /e "C:\Users\deffe\AppData\Local\Microsoft\Windows Mail\*" "F:\Mail\"
call "C:\Program Files\Windows Mail\WinMail.exe"

Run and Verify

Double click the batch file to execute your backup and check your backup folder to ensure you have all of your emails.

Download and Resources

Download the batch file here. You can edit the file as necessary.

Resources

xcopy
http://www.computerhope.com/xcopyhlp.htm

taskkill
http://www.tech-recipes.com/rx/446/xp_kill_windows_process_command_line_taskkill/

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Related Posts

Tags: , ,

Comments (2)

Leave a Reply





Donate

If you found this article useful and would like to see more like it this please consider making a donation.

Sponsors