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:
- Your source directory (the Store Location directory from above).
- And the destination backup folder.
- I will use my own directory structure for the example.
- 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/
Related Posts
Tags: backup, batch file, windows mail




























[...] Backup Windows Mail on Vista with xcopy [...]
Yahoo! i like it!