TheFuhrmans  
Family Photos, Video and Computer Advice  

Backup the Hard Drive

Why make a backup

Backup software

Backup hardware

Fast and inexpensive

Fast and Inexpensive Backup

Previous  Next

Last Updated: December 29, 2007


Poor Man's Backup Solution

Buy an internal 80GB hard drive for about $40.  It should be large enough to save your data files.  Below are a few lines of programming code that will work in any version of Windows and act as the backup software.  This solution won't have the safety features, easy of use, or ability to backup open files like backup software, but it's better than nothing.


Use a Free Batch File for Backup Software

A batch file is a few lines of text that perform operations on your computer such as copying.  Each line of a batch file is a different command.  It's similar to running a macro or a script.


How to Make a Batch File

Copy one of the batch file examples below to Windows Notepad (Start, Programs, Accessories, Notepad).  Click on File, Save.  When Notepad asks for a filename, type in backup.bat.  It's important to type in the backup.bat since this tells Windows this file is a batch file (.bat) and can be run rather than a text file (.txt) to be displayed in Notepad


A Warning About Batch Files

Please change the commands below to match your computer setup.  Batch files are powerful and lack many safety features that backup software contains.  Safety features include, but are not limited to, making sure you want to copy the files to the D: drive and not some other drive, the destination drive (D: drive) has enough free space to hold all of the files you are about to copy, and you want to automatically copy over a old file with a newer version of the file.  Do NOT run these batch files if you aren't comfortable in knowing what it is going to do.  I take no responsibility if these commands do not match the way your computer is set up.


How to Run a Batch File

To run the batch file, open Windows Explorer (Start, Programs, Accessories, Windows Explorer) or My Computer.  Navigate to the place where backup.bat is stored on the hard drive.  Double click on the filename to start it.


Make an Icon on Your Desktop

Using Windows Explorer (Start, Programs, Accessories, Windows Explorer) or the My Computer icon on the desktop, locate the batch file called backup.bat.  Right click on the filename to make the shortcut menu appear.  Click on Create Shortcut.  A new file will appear called "Shortcut to backup.bat."  To change the icon, right click on "Shortcut to backup.bat" to make the shortcut menu appear and click on Properties.  On the Shortcut tab, click on the Change Icon button.  A warning box will appear stating the shortcut does not have an icon.  Click on OK to make a selection of Windows icons to appear.  Choose an icon and click OK twice.  I like the CD with a green arrow icon and the memory card icon.  You can move the shortcut icon to the Start Menu (c:\documents and settings\{user name}\start menu) or to the desktop (c:\documents and settings\{user name}\desktop).


Batch File Examples

Copy these lines to Windows Notepad if you want to backup the entire C: drive


@echo off

echo Are you sure you want to backup your entire C: drive?

echo This will take awhile since there are tens of thousands of files to copy.

echo Press Ctrl+C to cancel or any other key to start.

pause

@echo on

xcopy c:\*.* d:\*.* /d /e /y


Copy these lines to Windows Notepad if you want to backup the data files and Windows files for Windows 2000/XP


@echo off

echo Are you sure you want to backup your documents and Windows folders?

echo This will take awhile since there are tens of thousands of files to copy.

echo Press Ctrl+C to cancel or any other key to start.

pause

@echo on

xcopy c:\windows\*.* d:\windows\*.* /d /e /y

xcopy c:\docume~1\*.* d:\docume~1\*.* /d /e /y


Copy these lines to Windows Notepad if you want to backup the data files and Windows files for Windows 95/98/98SE/ME


@echo off

echo Are you sure you want to backup your documents and Windows folders?

echo This will take awhile since there are thousands of files to copy.

echo Press Ctrl+C to cancel or any other key to start.

pause

@echo on

xcopy c:\windows\*.* d:\windows\*.* /d /e /y

xcopy c:\mydocu~1\*.* d:\mydocu~1\*.* /d /e /y


What Does The Code Mean?

The first word in each line in the examples above is a command.


xcopy c:\mydocu~1\*.* d:\mydocu~1\*.* /d /e /y

  • xcopy: xcopy has a lot more features than plain copy
  • c:\mydocu~1\*.*: The files that are to be copied and their location is given by stating the files are on the C: drive, in the My Documents folder, and every folder and file in My Documents is to be copied.
    • Batch files can only handle filenames with 8 characters, a period, and a 3 character extension.  This is referred to as 8.3 filename format.  Spaces can't be used, so they need to be removed from the batch files.  Names longer than 8 characters use the first 6 characters, a tilde (~) which is on the key above the tab key, and a numerical sequence number.  If two folders have the same first six characters, then one will have a ~1 and the other will have a ~2 at the end of the filename.  For example, the folder Family Photos 2005 will be shortened to family~1 and Family Photos 2006 will be shortened to family~2.
    • The asterisk (*) is a wild card and *.* means all folders and files.
  • d:\mydocu~1\*.*: The files and folders are being copied from the C: drive to the D: drive. This states the folder names and file names should appear the same way on the D: drive as they do on the C: drive.
  • /d: xcopy looks at the filename date and will only copy a file if the one on the C: drive is newer than the one on the D: drive.
  • /e: xcopy will copy empty folders.  Using it is optional.
  • /y: xcopy will automatically say "yes" for you when it asks if it is OK to copy a newer file on top of an older file.

To view the help file with a particular command, go to the command prompt by clicking on Start, Programs, Accessories, Command Prompt.  A black window will appear with a text based command prompt.  Type the command, a space, a forward slash, a question mark, and press the Enter key.  For example,

echo /?


You can make the command prompt window bigger by adding this to the batch file:

mode con lines=50

Previous  Next