Q:

Gracefully kill defrag.exe when run in command prompt

When I run defrag in command prompt is there any way to gracefully stop the process before it finishes?
Does killing the task in TM cause any problems if it is in the middle of moving a file?
Windows 7 Pro 64bit 

A:

Control C to cancel it.
I don't expect the Task manager to do any harm, since it first asks the program to close before it brute forces it.

A:

In theory, it should be safe to just terminate the program (in your case you can use CTRL-C) because an effort is made in the design of the Microsoft Disk Defragmenter application to prevent data loss in the event of an unexpected interruption.  This is documented on Microsoft's web site as follows:
The following steps are the processes by which Disk Defragmenter and
file system defragment an NTFS volume and update the MFT.

   1. Locate the fragments of each file throughout the disk.
   2. Copy the fragments to contiguous locations on the disk.
   3. Verify that the copy is an exact duplicate of the original file.
   4. Update the MFT in NTFS with the new location of the beginning of
      the file.
   5. Free up the space previously used by the file.

  Microsoft - How Disk Defragmenter Works
  http://technet.microsoft.com/en-us/library/cc778290(WS.10).aspx
  (the above text can be found under "Updating the Master File Table")
Essentially, the data is copied to new sectors, the pointers to the data that was moved are updated to point to these new sectors, and then the old sectors are freed as a result.  This is a very safe approach to use in case there is a crash because in a worst-case-scenario (like a crash into a blue screen) you'd have two copies of the same data, one on unallocated sectors, and the other on allocated sectors.  From the perspective of reading the data, it will appear the same either way.
Additionally, there are many improvements that can be made to the Disk Defragmentation techniques that Microsoft uses (which are already more than adequate for many people), and a variety of alternative products are examined and compared in great detail here:
  Defragger (from Roedy Green's Java Glossary)
  http://www.mindprod.com/jgloss/defragger.html

