The problem is almost always
that there is too much running on your system for the program
to perform its function.
The Defrag program (to open: My Computer
/ right click on your hard disk / Properties
/ Tools) will restart every time
a
file is changed, so if you have programs running at the same time that
e.g. write log files, then the program will eternally restart (A
similar thing can happen to the the disk Error Checking program
when in Thorough mode on prior versions of Windows).
Yes, you do need to run the program, or your hard disk will
become hopelessly fragmented, i.e. files will be on the disk in many,
many pieces, so every time you open a file your system has to find all
those pieces and put them together for you before it can even display
the file.
To get the program to complete you need to reduce what is running on
your system when you run Defrag. Do that by exiting any programs
you do not absolutely need. Get off the internet for one and
close or temporarily disable your AntiVirus program. Shutdown any
Real Audio, Messenger programs, MS Works, CD/DVD monitors,
etc. Check your taskbar
for icons and right click on them to see if they have Exit or Disable
options.
Then try Defrag and see if it can complete. Here is an
example of a completed Defrag on a housecleaned disk:

If that does not work then you need to run Defrag before all those
programs startup in the first place. To do that you need to
Shutdown your system with the Restart option. After the screen
comes alive on the boot hold down the F8 key. This will
put you into what is known as the Safe
Mode Startup Option Menu.
From here you want to take the Safe Mode with
Command Prompt
Option. When you get the command (DOS) prompt enter the following
commands:
Windows XP:
> cd C:\Windows\system32
(where C is the letter of your
hard disk)
> Defrag C: -a -v
(where C is the letter of your hard disk)
Let the program run and then it will display results.
Hold down the Ctrl and ALt keys then hit the Delete.
Your will get the Windows Task
Manager window.
Click the Shutdown tab at
the top
Select Restart.
System will reboot.
(Prior versions of Windows require
defrag to run in Windows so you won't be able to run it at the DOS
prompt) Once you get your disk defragmented you can
schedule defrag to run automatically to keep it that way using the Task
Scheduler.