On Twitter recently, DeAnna Burghart reminded us that if you use Microsoft Word, it's important to back up your
Normal.dotm file. If the file is overwritten or corrupted, you lose your macros, your keyboard shortcuts, and other goodies that editors rely on.
I've experienced that problem, gah. So a while back, I set up Windows so that it automatically backs up my
Normal.dotm file several times a day. I thought it might be useful to show other people how I did this.
Sad note: The information in this post applies only to Windows. I'm sure there's a way to do this on the Mac, but I don't currently know how to do it.
I realize that this is a long post and therefore looks complicated. It isn't, I promise! I added some extra steps to test as you go to try to make sure that you don't Experience Disappointment.
Update: I created a video version of this tutorial!
To back up your
Normal.dotm file, you copy it from its default location (i.e., where Word looks for it) to some other location. AFAIK, the default location is always this:
For example, my
Normal.dotm file is here:
You can certainly copy the file manually. But you can also automate the copy process so that Windows copies the file for you. You might sometimes forget to back up your file by hand, but if you automate the process, you never need to worry about it.
What I did—and what I'll show you here—is that I created a script. The script doesn't just copy the
Normal.dotm file to another folder. During the copy process, it names the backup file by adding a date and time stamp. For example, the script creates a file that has a name like this:
You can see that the filename includes the date (Apr 26, 2021) and time (5:49 pm). Timestamping the backup files has two advantages:
- Each time you run the backup, you make a new, different backup file. This can be useful if
Normal.dotm gets corrupted—you have multiple backup versions of the file, some of which (hopefully) are older than when the corruption occurred.
- You know when the backup was made.
I use two technologies for the automated backup:
- PowerShell. This is a programming language that lets you automate Windows tasks like copying files. PowerShell has been in Windows since Windows 7, so you don't need to install anything. I have the complete script in this post, so you don't need to know PowerShell; you can just copy and paste the script.
- Windows Task Scheduler. This is a Windows utility that lets you run tasks—for example, a script—at specific times or at intervals.
Create the PowerShell script
- Create a folder named
C:\backup on your computer to copy the backup files to.
You don't have to use this folder; you can use any folder you like. Just make sure that the folder already exists. (The script won't create it.) If you don't use
C:\backup, you need to make some minor changes later.
- Open a text editor (for example, Notepad ... don't use Word for this), create a new file, and then copy the following script into it:
# PowerShell script to back up the Word Normal template (Normal.dotm)
# 2020-Apr-26 Mike Pope
$bu_path = "C:\backup"
$bu_datetime = Get-Date -Format "yyyy-MM-dd HH_mm"
$source_file = $env:appdata + "\Microsoft\Templates\Normal.dotm"
$dest_filename = $bu_path + "\Normal(" + $bu_datetime + ").dotm"
Copy-Item -Path $source_file -Destination $dest_filename
- If you don't want to use the
C:\backup folder, change the path in the third line (the one that starts with
$bu_path =). Make sure that you don't add a trailing backslash (\) to your path.
- Save the file to the
C:\backup folder (or your alternative) using the following name:
.ps1 extension is used for PowerShell scripts.
- Close the text editor.
Test the script
Before you create a scheduled task for the script, it's a good idea to make sure it's working on your computer.
Open a Windows command window. (Press
Windows+s, then type
CMD). You see a command line:
Enter the following command (better yet, copy and paste it):
powershell.exe -ExecutionPolicy Bypass -File "C:\backup\back-up-normal-template.ps1"
Again, if you're not using
C:\backup, substitute your folder name.
The command invokes PowerShell and tells it to run the script that's in the
back-up-normal-template.ps1 file that you created earlier. The
ExecutionPolicy argument tells PowerShell that your script is safe; if you don't include this part, PowerShell will refuse to run the script due to security concerns.
If all goes well, the script displays the name of the backup file, like this:
If you see red text, read it carefully. Carefully check the command that you entered. You might also need to fix the script itself (the
.ps1 file). Some possibilities:
- The script you used earlier assumes that the
Normal.dotm file is in the default location. If the file is in a different location, it's possible the script isn't finding it.
- If you're not using the
C:\backup folder, did you fix up the script to reflect the folder that you are using?
You must resolve any errors before you can proceed.
If the script appeared to run correctly, look in the
C:\backup folder (or the folder you are using instead). Do you see a
.dotm file that starts with
Normal followed by a date and time? If so, everything is working.
Schedule the backup
You can now configure Windows to run your script at intervals. You do this by creating a scheduled task. When you create the task, you specify what you want to run (the PowerShell command that you just tested) and when you want to run it.
Open the Task Scheduler app. (Press
Windows+S, then type
In the folder tree on the left, right-click Task Scheduler Library and then click New Folder. Name the new folder My Tasks. This step isn't essential, but it makes it easier for you to find your custom task later if you want to modify it.
Right-click the My Tasks folder and click Create Task. This opens the Create Task dialog, which has several tabs that you'll be working in.
Note: Don't close the Create Task dialog (that is, don't click OK), until you've done all the steps.
In the General tab, do the following:
In the Name box, enter the name
In the Description box, enter details about what this task is about.
Go to the Actions tab and click New. This is where you specify what you want to run—namely, the PowerShell script.
In the Program/script box, enter
In the Add arguments box, enter the following:
-ExecutionPolicy Bypass -File "C:\backup\back-up-normal-template.ps1"
These settings specify that you want to run the PowerShell script that you tested at the command line earlier.
Click OK to close the New Action dialog and return to the Create Task dialog.
Go to the Triggers tab and click New. This is where you specify when (how often) to run your script.
Under Advanced settings, select the checkbox next to Repeat task every.
Enter an interval for how often you want to run the script. For example, to run the script twice a day, enter
12 hours. (It doesn't look like it, but you can type in that box.)
In the for a duration of list, choose Indefinitely. This tells Windows to keep running the script until you change the interval or delete the scheduled task.
Click OK to close the New Trigger dialog.
In the Create Task dialog box, click OK.
Note: Don't close the Task Scheduler window yet.
Test the scheduled task
You know that the script runs; now you want to make sure that the scheduled task works.
In the Task Scheduler, in the file tree, click the MyTasks folder. The list of scripts in that folder is displayed on the right.
In the right-hand pane, right-click the BackupNormalTemplate task and then click Run.
The PowerShell scripting window appears briefly, then vanishes.
- Go to the
C:\backup folder and check that another backup copy of the
Normal.dotm file has been saved.
If this worked, you should be all set.
Close the Task Scheduler app.
You probably want to check the
C:\backup folder tomorrow and the next day to make sure that the script is writing out backup files at regular intervals.
If you need to recover a
Normal.dotm file, go to the
C:\backup folder, rename one of the backup files to just
Normal.dotm, and then copy it back to the folder where Word keeps the template.
Hopefully you'll never need to do that. But if you do, you'll have a recent backup available!