Defraggler comes with a command-line version of the GUI program called df.exe. This program is located in the same folder as defraggler.exe, typically C:\Program Files\Defraggler.

You can pass commands to df.exe using batch files. The syntax for calling df.exe is as follows:

df.exe [file or filemask or folder or drive label] [/?] [/L] [/S] [/debug]

Where:

Parameter Description
/? Help switch: Displays a list of available parameters and provides examples.
/L Lists all drives that Defraggler can defragment on this computer.
<drive>
Defragments the specified drive.
<item>
Defragments the specified file or folder. You can chain multiple <items> together, but they all must be located on the same drive.
/S
For a specified folder, Defraggler will also defragment any subfolders beneath it (recursive).
/debug
/debug2
/debug3
Runs Defraggler in debug mode for troubleshooting purposes. Debug2 and Debug3 provide increasingly more details. See this topic for more information about the log files that debug creates.
/shutdown Shuts down the computer after Defraggler completes operations.
/large During defragmentation, Defraggler moves large files to the end of the drive to improve performance. For more information, see this topic. Defraggler will use the existing settings on the Defrag tab of the Optionsdialog box.
/QD Defraggler will use the Quick Defrag process (faster, but not as efficient as regular defrag). You can only use the /QD flag when defragmenting an entire drive -- not a specific file or folder. You cannot use the /QD flag with the /large flag; Defraggler will return an error message.
/fs Defrag Freespace - Defraggler will fill up freespace chunks with whole files only in order to reduce the level of freespace fragmentation.
/fsaf If you select Defrag Freespace (Allow fragmentation), Defraggler will use file fragments to fill up freespace. Defrag Freespace (Allow fragmentation) will defrag freespace to the highest possible level.

 

Examples

df.exe C:\testfile - defragments the file C:\testfile.exe.

df.exe C:\Windows /shutdown - defragments all files in the Windows folder on C:, and then shuts down the computer.

df.exe C:\Windows\*.exe - defragments all .EXE files in the Windows folder on C:.

df.exe "C:\Program Files\*.exe" C:\Windows C:\new.txt - defragments all .EXE files in the Program Files folder, all files in the Windows folder, and the new.txt file at the root of C:.

df.exe C:\ /large - defragments all files on the C: drive, and moves large files to the end of the drive.

 

 

Links

https://www.piriform.com/docs/defraggler/advanced-usage/command-line-parameters

https://www.piriform.com/defraggler