UltraDefrag command line tool udefrag.exe the installer places to the system32 directory. Therefore it may be run without specifying the full path. View screenshots...
Command line options
Usage:
udefrag [command] [options] [volumeletter:]
Commands:
- -a, --analyze
- Analyze volume.
- --defragment
- Defragment volume. This key is optional. Specifying just the volume letter will cause UltraDefrag to defragment the volume.
- -o, --optimize
- Optimize volume space by moving all files to the begining of the volume.
- -l, --list-available-volumes
- List all volumes available for defragmentation, except removable. Each line of output contains volume letter, filesystem name, total space and amount of free space.
- -la, --list-available-volumes=all
- List all volumes available for defragmentation, including removable.
- -h, -?, --help
- Show help screen. Running UltraDefrag without arguments have the same effect.
Options:
- -b, --use-system-color-scheme
- Use system (usually black/white) color scheme instead of the green color.
- -p, --suppress-progress-indicator
- Hide progress indicator.
- -v, --show-volume-information
- Show volume information after a job completion.
- -m, --show-cluster-map
- Show map representing clusters on the volume.
- --map-border-color=color
- Set cluster map border color. Available values: black, white, red, green, blue, yellow, magenta, cyan, darkred, darkgreen, darkblue, darkyellow, darkmagenta, darkcyan, gray. Yellow color is used by default.
- --map-symbol=x
- Set a character used for the map drawing. There are two accepted formats: a character may be typed directly, or its hexadecimal number may be used. For example, --map-symbol=0x1 forces UltraDefrag to use a smile character for the map drawing. Valid numbers are in range 0x1 - 0xFF. The % symbol is used by default.
- --map-rows=n
- Number of rows in cluster map. Default value is 10.
- --map-symbols-per-line=n
- Number of map symbols containing in each row of the map. Default value is 68.
- --use-entire-window
- Expand cluster map to use entire console window.
- --wait
- Wait until already running instance of UltraDefrag completes before starting the job (useful for the scheduled defragmentation).
Volume letter:
- Specifying just the volume letter will cause UltraDefrag to defragment the volume.
- It is possible to specify multiple volume letters. Like this: udefrag c: d: x:
- Also the following keys can be used instead of the volume letter:
- --all
- Process all available volumes.
- --all-fixed
- Process all volumes except removable.
Note that --all-fixed key has more precedence, if both keys are specified UltraDefrag will process fixed drives only.
Environment variables
- UD_IN_FILTER
- List of files to be included in defragmentation process. File names must be separated by semicolons.
- UD_EX_FILTER
- List of files to be excluded from defragmentation process. File names must be separated by semicolons.
- UD_SIZELIMIT
- Exclude all files larger than specified. The following size suffixes are accepted: Kb, Mb, Gb, Tb, Pb, Eb.
- UD_FRAGMENTS_THRESHOLD
- Exclude all files which have less number of fragments than specified.
- UD_TIME_LIMIT
- When the specified time interval elapses the job will be stopped automatically. The following time format is accepted: Ay Bd Ch Dm Es. Here A,B,C,D,E represent any integer numbers, y,d,h,m,s - suffixes used for years, days, hours, minutes and seconds.
- UD_REFRESH_INTERVAL
- Progress refresh interval, in milliseconds. The default value is 100.
- UD_DISABLE_REPORTS
- If this environment variable is set to 1 (one), no file fragmentation reports will be generated.
- UD_DBGPRINT_LEVEL
- Control amount of the debugging output. NORMAL is used by default, DETAILED may be used to collect information for the bug report, PARANOID turns on a really huge amount of debugging information.
Note that all filters are case insensitive. And currently they cannot exceed the 4096 characters length. Each filter substring represents a pattern, UltraDefrag will search for in a paths. For example, the "temp;tmp" filter will be applied both to temporary folders and to Internet Explorer's cache.
Note that files excluded by filters are shown on a cluster map always as unfragmented. Because trash is unimportant anyway and it should not take an attention.
Example batch scripts
The following example illustrates defragmentation of the few different volumes in series adjusting parameters separately for each volume.
@echo off
set UD_EX_FILTER=system volume information;temp;recycler;.zip;.7z;.rar
set UD_SIZELIMIT=50Mb
udefrag c: > c:\ud.log
set UD_IN_FILTER=My Documents
udefrag d: >> c:\ud.log
set UD_IN_FILTER=
udefrag e: >> c:\ud.log
Notice that we are excluding archives in a script above. Because they are usually rarely accessed and may be left fragmented therefore without noticeable system performance degradation.
The next example demonstrates how easily the complex disk defragmentation job may be automated.
@echo off
rem Defragment small files.
set UD_SIZELIMIT=50Mb
udefrag c:
rem Defragment large files
rem which have at least 5 fragments.
set UD_SIZELIMIT=
set UD_FRAGMENTS_THRESHOLD=5
udefrag c:
The following three commands are very useful too in the disk defragmentation scripts:
- chkdsk checks volumes for errors
- shutdown -s -t 00 automatically shuts down the computer
- hibernate4win now hibernates the computer
The last command is included in UltraDefrag package. It was made especially to hibernate the computer through command line after a disk defragmentation which may take a lot of time.
Explorer's context menu handler
The UltraDefrag command line tool is also used as an Explorer's context menu handler. When you right click drive/folder/file icon in Explorer you can select an appropriate menu item to defragment the selected object.
To stop the defragmentation press Ctrl+C keys 4 times or close the command prompt.
Currently the context menu handler is not available in the portable version of the program.