Boot time interface commands

Last updated on Jul 3, 2021

The boot time interface of UltraDefrag supports a wide set of commands.

Note

Commands displaying long lists (help, hexview, history, man, set, type) do split their output into multiple pages with the prompt to hit any key to continue between them in the interactive mode.

boot-on

This command enables the boot time defragmentation for subsequent system reboots.

boot-off

This command disables the boot time defragmentation for subsequent system reboots. It is a good idea to put this command to the beginning of the boot time script to make sure Windows will remain bootable even if something will go wrong during defragmentation.

call

This command is similar to the equivalent Windows command. It executes a batch script. If none is specified the command executes the main boot time script (%SystemRoot%\system32\ud-boot-time.cmd):

1
2
:: execute the C:\WINDOWS\system32\my-boot-time-script.cmd script
call C:\WINDOWS\system32\my-boot-time-script.cmd

echo

This command is similar to the equivalent Windows command. It displays a message or an empty line, sets whether the commands will be shown on the screen or not, or displays the current setting:

1
2
3
4
5
6
7
8
9
10
:: do not display commands on the screen
@echo off

:: show the current status of echo

echo

:: display a couple of messages with an empty line in between

echo Hello!
echo.
echo Greetings from Georgia!

exit

This command is similar to the equivalent Windows command. It terminates the script execution and passes control back to the Windows boot process. It is a good idea to put this command to the end of the boot time script unless you want to use the interactive boot time console.

help

This command displays the list of all the available commands.

hexview

This command displays a file in a hexviewer layout:

# hexview %SystemRoot%\system32\my-boot-time-script.cmd

0000000000000000: ff fe 40 00 65 00 63 00 | ӱϸ@ e c
0000000000000008: 68 00 6f 00 20 00 6f 00 | h o   o
0000000000000010: 66 00 66 00 0d 00 0a 00 | f f    
0000000000000018: 62 00 6f 00 6f 00 74 00 | b o o t
0000000000000020: 2d 00 6f 00 66 00 66 00 | - o f f
0000000000000028: 0d 00 0a 00 0d 00 0a 00 |        
...

The hexview command is useful for troubleshooting. For instance, if you will save a boot time script in an encoding other than UTF-16, UltraDefrag will not be able to execute it. To check whether the script encoding is correct or not, you can use the hexview command to check the first 2 bytes of the script. If the script encoding is correct, you will see ff fe in the beginning of the script, as in the example above.

history

This command displays the list of all the manually entered commands. To cycle through them use the up/down arrow/cursor keys on the keyboard.

man

This command displays a manual page or the list of all the available manual pages if called without an argument:

1
2
3
4
5
:: list all the available manual pages
man

:: display the udefrag command manual

man udefrag

pause

This command pauses the script execution for the specified number of milliseconds or displays a message Hit any key to continue… and waits till a key is pressed if no duration is specified:

1
2
3
4
5
:: pause the script execution for one second
pause 1000

:: pause the script execution till a key is pressed

pause

reboot

This command reboots the computer.

set

This command is similar to the equivalent Windows command. It sets, clears and lists environment variables:

1
2
3
4
5
6
7
8
9
10
11
:: show all the environment variables
set

:: show all UltraDefrag specific environment variables

set UD_

:: set the UD_IN_FILTER environment variable

set UD_IN_FILTER=*windows*

:: clear the UD_IN_FILTER environment variable

set UD_IN_FILTER=

shutdown

This command shuts the computer down. It is especially useful when you perform an operation which takes a lot of time, for instance, the disk optimization:

1
2
3
4
5
6
:: optimize the system disk
udefrag -o %SystemDrive%

:: shut the computer down when

:: the disk optimization finishes
shutdown

type

This command is similar to the equivalent Windows command. It displays a file on the screen. If no file is specified the command displays the main boot time script:

1
2
:: display the custom boot time script
type %SystemRoot%\system32\ud-boot-time-custom.cmd

The main purpose of the type command is troubleshooting. For instance, you can easily display your boot time scripts using it in the interactive console to check them for syntax errors. Also you can use the type command to display long pieces of text and even to read books at boot time 🙂

# type c:\books\the-sign-of-the-four-chapter-3.txt

                      Arthur Conan Doyle
                     The Sign of the Four
 
                         Chapter III

                    In Quest of a Solution
                   
It was half-past five before Holmes returned. He was bright, eager,
and in excellent spirits, a mood which in his case alternated with
fits of the blackest depression.

"There is no great mystery in this matter," he said, taking the cup
of tea which I had poured out for him. "The facts appear to admit of
only one explanation."

"What! You have solved it already?"

"Well, that would be too much to say. I have discovered a suggestive
fact, that is all. It is, however, very suggestive. The details are

Hit any key to display the next page, Esc or Break to abort...

udefrag

This command is a boot time equivalent of the udefrag command from UltraDefrag CLI. It supports the following command line switches: -l, -la, -a, -o, -q, --optimize-mft, --all, --all-fixed, --deep.

To process individual files and directories specify their full paths and enclose them by double quotes if the paths contain spaces:

1
udefrag "C:\Documents and Settings\*" C:\WINDOWS\WindowsUpdate.log