Windows Backup And Restore Made Easy

From OpenEMR Project Wiki



This process of backup is a refinement and simplification of Joe Holzer's method. Knowledge of programming and of Command Prompt is not required.

In reference to the built-in backup utility, once constructed properly, this method is just as simple to use. Comments on OpenEMR Forum stressed that browser-based backups are not reliable. In a recently restored backup after using the native tool, all the scanned documents were missing and the LBV forms had to be re-configured. Recovery with this method does not necessitate the unbundling of the backup file, copying and replacing of the openemr\sites\default folder and the rebuilding of the MySql database.

Unlike the Joe Holzer method the entire XAMPP directory is replicated, not just the four htdocs\openemr folders and the MySql database. Recovery does not require that XAMPP-OpenEMR be downloaded and the files to be copied onto the download.


Two pieces of information are necessary before construction of the tool.

1) The version of Apache must be known. A quick way to find out, go to Control Panel->Systems and Security-> Administrative Tools->Services. In the list of Services, look for the number next to Apache. See Figure 1.

2) You will need to know the letter drive of the backup device. Insert the device. Go to Windows Explorer, under Computer is the letter of the drive. See Figure 2.


1) Open Notepad to create an empty folder.

2) Under the File tab, choose Save As, type in check.bat as the File Name and use the default Text Documents as the Save As Type. Save to C-drive. Click Save. See Figure 3.

3) Verify that it is in C-drive by going to Windows Explorer and then to C-drive. See Figure 4.

4) Open Notepad again, copy and paste the following set of commands:

net stop "mysql"

net stop "apache2.4"

cmd /c cd C:\

if exist C:\check.bat xcopy C:\xampp\*.* F:\xampp\ /d /e /c /i /f /h /k /y

net start "apache2.4"

net start "mysql"

5) Change the version of Apache if it is not 2.4 in lines 2 and 5 of the script and the drive letter if it is not F in line 4.

6) It is very important that these next 2 steps are executed exactly as stated to avoid problems. Under the File tab, choose Save As. In the File Name bar, type in C:\users\XXX\desktop\backup.cmd where XXX is the name of the account that you signed into at the Windows Welcome Screen.

7) In the Save As Type bar, click the drop down menu and choose All Files. Click Save. If you use the default of Text Documents, you will have only a document of the instructions and not the actual command to execute the backup. See Figure 5.

8) Go to the Desktop. If you see an icon with two cogged,intermeshing wheels, then the text file was successfully converted into a command file. See Figure 6.


1) Log off OpenEMR.

2) Double click the backup.cmd icon on your Desktop.

3) Command Prompt will appear and start the backup and save it to your device. See Figure 7. Flash drives, SD card and external hard drives have been used successfully as backup media. DVD's have not been tested. To change the drive of the destination device, right click on the backup.cmd icon and choose Edit.

4) When Command Prompt has completed the task, it will close automatically and a new folder, XAMPP, will appear on the backup device.


1) Send the XAMPP folder to C-drive.

2) Go to C:->XAMPP->XAMPP Control and double click that file. The orange icon has a symbol that looks like a dog bone in the middle of it. See Figure 8.

3) Under Modules Service click the red x changing it to a green check mark to install Apache and then under Actions, click Start to begin the service. Do the same for MySql. You have to "turn on the lights" before getting back to work. Both modules are ready to use when the PID(s) and Port(s) are populated with numbers. See Figure 9.

4) If you are interested in verification of the accuracy of the backup using just the copy on the destination device, you may need to use XAMPP Start and XAMPP Stop if XAMPP Control does not work. The copy on the device runs only at 80% speed compared to that installed on C-drive, but it is still a very handy feature if verification is the only objective. See Figure 10.

5) Log on by typing in http://localhost/openemer in the URL bar. Now it is back to work we go.

The elegant script and technical advice have been graciously supplied by cverk of the OpenEMR Forum. It would not have possible for us to construct the tool without the invaluable technical assistance of Kevin Yeh, M.D., of IntegralEMR. Pieter W. Blankevoort, M.D.,(a.k.a. the LBV Guru) was kind enough to take time from his medical practice on a sunny isle to brainstorm.

Good luck and smooth sailing.