In the present article, we take up a border issue of the whole: How to develop your own DEFRAG program. Why should you program something like that? The advantages are that the resulting piece of software can be slim and, in that case, only a few resources. Furthermore, for some the factors are “feasibility” exploring “,” really useful “and” educational “factors that play in here. We limit ourselves to some basics below.
A defragmenter with little programming – what you need for it
Defrag C: /O
Defrag D: /O
Defrag f: /o
With Ctrl-S you save, putting a script file with the ending “.cmd” in a folder of your choice. Right click on the file and with “Run as administrator” call the work. The /o parameter takes place for each drive that is specified via its drive letter, the ideal maintenance: a hard drive is defragmented and an SSD is trimmed.
Contig miss a gui-anlitz

Contig drilled: knew how, the use of the tool succeeds more comfortably than normally.
Photo: computer picture
A possible procedure:
1. Download Contig and unzip the “Contig64.exe” file from the obtained zip archive.
HKEY_Classes_root \*\ Shell
3. Create a registry key with “Edit> New> Key”, which you call “Defrag”. This means the new command/entry in the context menu of your files for defragmentation.
4. Create a sub key from “Defrag” with the same click sequence. Name him “command”.
5. With marked “Command” Subkey in the right window area, click twice on the registry entry “(Standard)”. Date the following command:
6. Optionally, give your context menu input/command a symbol by create a registry entry called “Icon” in the “Defrag” key via “Edit> New> String”. In it they give a symbol file path like C: \ Windows \ System32 \ dfrgui.exe to.
Integrate the contig in Total Commander

The Total Commander allows individualization by integrating (Defrag) software.
Photo: computer picture
The procedure for setting up the whole includes a few steps:
1. Download the totally commander and call it up.
2. Duplicate the Notepad icon in the above toolbar on the right by clicking it right and going to “Copy”; Whereupon you make right -click and command “inserting”.
3. Click the new icon with the right mouse button and select “Change” in the context menu.
4. In the windows that open up, put in the “Command” field at the top of the “Command” cmd.exe /k to. Below with “Parameter” you store the following:
5. Optionally, they also assign a suitable symbol to the right of “Icondatei” on the right and navigate to C: \ Windows \ System32 \ dfrgui.exe.
To defragment a file, select it in Total Commander with a click. Then right -click the new symbol and choose “as administrator”. If you have started the Total Commander with administrator rights, equivalent is sufficient to get left-click on the fresh illustration.
Program Defragmenters – with “own” engine
Last but not least, you can create a batch file to which you pull your files on the drag & drop to defragment them. The DEFRAG procedure looks like a corresponding file is copied. Such a copy – depending on the physical circumstances on the data carrier – is steady or fragmented as possible. The original file is deleted and the copy is renamed so that it bears the original file name again.
The following batch code, for example, makes it possible:
Setlocal Enabledelayed expansion
:: check whether a file was handed over by drag & drop
if “%~ 1” == “” (
Echo pull a file onto this script to defragment it.
pause
Exit /b
)))
:: File path and name extract
Set “Filepath =%~ 1”
Set “Filename =%~ nx1”
Set “Dirpath =%~ dp1”
Set “Tempfile =%Dirpath %% Random%_%Filename%
:: Copy the file and delete original
Copy “%Filepath%” “%Tempfile%”> Nul
del “%Filepath%”
:: rename copy back
ren “%tempfile%” “%filename%”