Jump to content
CCleaner Community Forums

a better shell for Defraggler and a better Scheduled Tasks Handling

Recommended Posts

I Have made 2 small execute that ease up the defrag process for entire drive




they are best used for:

• Shell "Right Click" on Drives (in "My Computer" for example)

• Manually Setting a Tasked Job under Windows.


Shell Assist and Shell Assist Hidden should be putted in same directory as df.exe




I will give a full manual, screens attached for setting it manually.


basically those programs are simple Visual Basic 6 program that uses the command


df.exe [drive letter]:



I have notice that the existing posts about context defrag in this forum using a slightly different solution,

but mine is better, I will explain later on because we need more information (also existing here :) )


What is Shell Assist and Shell Assist Hidden ?

Shell Assist (and Shell Assist Hidden) will run a full defrag Job (whole drive only) using df.exe, it needed to be passed with an argument of drive letter ("c", "c:", "c:\" will all say "Whole Drive C Please !" in this case.


what's about the Hidden Stuff?

it will do same job- run a defrag job for the whole drive, but WILL NOT Show a CMD window at all, it will only could be seen in task-manager.


The hidden property will help you to prevent anyone to close the CMD window of df.exe manually.


You can always stop df.exe by hand using "End Task" in the Task-Manager. Notice that it is safe to do this, because the df.exe is only a manager for the defrag job and not actually doing the moving of files,

it opened threads (or a "little sub processes" that does it for him), when ever df.exe is no longer running, the file moving is closing down neatly, so it is perfectly 100% safe to close df by Task-Manager (don't use the "End-Task-Tree" though).



You can choose (in the manual down below) if you would like to use: Shell Assist or the hidden one (Shell Assist Hidden), what ever is suitable for you, I recommended you to use same as me.



Manual Creating Scheduled Tasks (under win2k/XP, vista is very similar)


Open Control Panel <img>http://i41.tinypic.com/2n0iljp.jpg</img>,

Scheduled Tasks 2gsgx37.jpg,

Right Click and select <img>http://i40.tinypic.com/2hgqlua.jpg</img>


you will get a new task <img>http://i40.tinypic.com/2u6z8mb.jpg</img>

named it Defraggler C


Double click it and click Browse



Browse your install directory of defraggler (mine is in C:\Program Files\Defraggler), select the "Shell Assist Hidden.exe" (I would like my task to run hidden, because I don't want anyone to close it by hand).


press open.


have a look here:



add one space after the path your drive letter c like that "c"


"C:\Program Files\Defraggler\Defraggler Shell Assist Hidden.exe" "c"




copy defraggler's path (path only) and paste it in the "start in" textbox:


"C:\Program Files\Defraggler"




mark the V under "run only if I logged on"



this is the result so far:




Now let us pass to the Schedule Tab <img>http://i42.tinypic.com/2znslyw.jpg</img>


short explain:

since we are going here for a multi drive defrag, we would like set set a different drive for each day,

because it is known fact that defraggler does not work best (if all) if set to do drive c and d at same day and time,

so we will set drive C for sun,tue,thu and drive D (were not there yet..) to mon,wed,fri.

If you have any more drives make the changes in timing.


(continue of the manual)

change daily to "Weekly", now you can select the days as we said before, remember- we are working on "drive c" now. also set the start time to be about 03:00 am, it is a good time to start the defrag job because it is "after time" so the result for now is:



a few more changes to "fine adjust":

switch to the Setting Tab and change the <img>http://i44.tinypic.com/idhsmu.jpg</img>

to something like this <img>http://i39.tinypic.com/2i8amhs.jpg</img>

cause we don't want that will be overlapping between jobs, 5 hours to run this job will do.

also, the df.exe will self close when finished (if finish earlier).


to finish this- press OK.


now return this from the beginning (from the right click and "new job"),

the only difference is that you should write


"C:\Program Files\Defraggler\Defraggler Shell Assist Hidden.exe" "d"

(instead of c),

and give another set of days for this job of D drive.


once finish doing so for all drives you will be having two ready to start Scheduled Tasks,

that will work hidden every day of the week (not Saturday though..)


*they will work as long your computer is on, and you are logged in (that could be changed but it is not recommended therefor I will not explain that in here)



Part Two is - How to add Defraggler to Right Click Context Menu For Drives Only

an extra explain on how to add a folder context menu will be added at buttom


now we will be use the "Shell Assist.exe" File (not the hidden one), you can naturally pick the other one,

but since you are physically clicking on the drive, you might want the job's process to be visible.


open your favorite registry editor (Registry Workshop)

you can use the windows regedit.exe (start->run->regedit.exe [enter]) but I think it is horrible...


browse this address




If you haven't use registry before this all seems a little like a windows explorer tree, well... is does similar to.. but here a "directory" is called a Key.

once you are in the "shell" directory, right click inside and select new Key.





name it "defragglerShell"

look inside defragglerShell, notice (Default) ?

double click it, you will get a small inputbox. <img>http://i39.tinypic.com/bfrt3t.jpg</img>

type in


Defraggler This





now right click inside the "defragglerShell" Blank Content window and select "New Key" (like we done, again).




name the new "folder"(actually called a KEY) to be command

have a look what we done so far:



have you notice the "file" called (Default) ? present inside defragglerShell\command (not the one directly under defragglerShell)


double click it so a small inputbox will open



Assuming the install path of Defraggler is C:\Program Files\Defraggler enter inside:


"C:\Program Files\Defraggler\Defraggler Shell Assist.exe" "%1"



what the means ?

say you click on drive C, the mark "%1" is known to windows (reserved word), it is replaced by the string c:\

do you remember what I said before?

"c:\" originally meant by df.exe to defrag only the files under c:\ (no sub folders..), BUT (!) if you are using my small program instead df.exe, what is actually done is that ny program gets "c:\" as argument, trim away all inverted commas then cut the letter 'C', next it simply runs "df.exe [drive letter]:"


happily, you don't need to know this.

clicking on drive C will run df.exe c:

same way for any drive


but enough with my nonsense... :)


this is the result <img>http://i42.tinypic.com/292a42u.jpg</img>

press enter to get going.. <img>http://i44.tinypic.com/10croyq.jpg</img>


effective instantaneously !




That's It.


Now you have :


• 2 Scheduled Tasks, all drives (intermittently).

• a right click context menu for you to use.


hope you make a good use of df.exe and defraggler.exe which are superlative tools, for admins and power users.




source code for your interest (microsoft visual basic 6) all the source code is visible through the zip Attached to this post.


Option ExplicitPrivate Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As LongPrivate Const SW_HIDE As Long = 0Private Const SW_SHOWNORMAL = 1Public Sub Main()If (Len(Command) < 2) Then	MsgBox "You Should Run Me with " & App.EXEName & ".exe [drive name for example c:] " & vbNewLine & "it will defrag full drive" & vbNewLine & "EladKarako", vbOKOnly Or vbInformation, "Please Notice"	Exit SubElse	Dim s As String	s = Left(Replace(Command, Chr(34), vbNullString), 1) & ":"	Call ShellExecute(0, vbNullString, App.Path & "\df.exe", s, App.Path, SW_SHOWNORMAL)	DoEvents	Call Sleep(100)	DoEvents	Call setPrioProc_by_exe("df")End IfEnd Sub




Elad Karako.


email removed to prevent spamming ~ moderator





WOW that was sure a huge amount of time with all those screenshots,

I have noticed that in some time this forum system most probably does not support presenting more then a few shots per post, meanwhile I have changed the to <img> to fool the picture counter but you can click to see the picture. so please if any responsible person would notify the forum admin, to tweak the limit up a bit.. and notify me (or even better edit this post him/her self) it would be very much appreciated.

it would be nice to see all those shots in same page.








Elad Karako

.Net Developer


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...