PDA

View Full Version : run a looping defragmentation



EdCompSci
03-19-2006, 05:39 PM
I'd like to know if anyone knows if, using VBA, a routine can be made that

first
opens dfrgntfs.exe (Windows defragmenter)

then
picks a drive (it has to do this because I have multiple partitions)

then with a for next loop
defragments the drive

THEN
receives a message that defragmentation is complete and then restarts defragmentation. This would be very useful when multiple runs are necessary to eliminate all of the red part of the defrag graph.


- Edward
Below is my really outdated website, but someday I'll get back to working on it
http://www.edwardtisdale.com (http://www.edwardtisdale.com/)

Killian
03-22-2006, 06:07 PM
Hi there,

While this is sort of possible using VBA, I'm not sure why you would do it.
Effectively, however you do this, you will need to run defrag.exe from a command line ("dfrgntfs.exe" is the win32 app and doesn't run from a command line).
You can see the syntax for the arguments (which drive and some other options) by typing defrag at a command prompt.

To run defrag in the background with vba you'd useConst strCmdLine As String = "your path to defrag.exe and arguments"
Shell strCmdLine, vbHide but I think controlling multiple passes and different drives consecutively will be a PITA

Is there any reason you can't run scheduled defrags via the control panel?

EdCompSci
03-26-2006, 09:21 PM
As far as running scheduled defrags, I might try that with defrag.exe as well as trying your code. Going through Scheduled Tasks in System Tools (Win2k Pro) doesn't allow me to schedule a defrag otherwise. Thanks for the help. Is that what you meant by the Control Panel? I know when I had win98 I could do that, or maybe it was on WinNT4.0wks.


Also, I'm new here; what is PITA? Something bad I can guess.

geekgirlau
03-27-2006, 02:08 AM
Pain in the [insert appropriate body part] :tongue2:

johnske
03-27-2006, 05:03 PM
Hi Edward,

I find the windows defrag won't work if you're trying to do something, it tends to restart over and over. Not only that, it's really slow and doesn't do a very good job of defragmenting at all...

Try Diskeeper (http://www.executive.com/downloads/menu.aspx) (30 day free trial - then pay. Alt: see if you can find a download for the free Diskeeper Lite). Diskeeper will defrag in the background and you can schedule it to run when there's a period (choose your own period) of inactivity.

There's other defrags out there, but in my experience the inbuilt windows one is the worst of them all :)

Regards,
John

EdCompSci
03-29-2006, 07:42 PM
Hi Edward,

I find the windows defrag won't work if you're trying to do something, it tends to restart over and over. Not only that, it's really slow and doesn't do a very good job of defragmenting at all...

Try Diskeeper (http://www.executive.com/downloads/menu.aspx) (30 day free trial - then pay. Alt: see if you can find a download for the free Diskeeper Lite). Diskeeper will defrag in the background and you can schedule it to run when there's a period (choose your own period) of inactivity.

There's other defrags out there, but in my experience the inbuilt windows one is the worst of them all :)

Regards,
John

Thanks I'll look for diskeeper lite

EdCompSci
03-29-2006, 07:57 PM
but I think controlling multiple passes and different drives consecutively will be a PITA

Yeah, I don't necessarily want to do it with multiple drives, just the same one over and over.

PC509
04-30-2006, 06:18 PM
You might also look into O&O Defrag Professional. It seems to do a very good job defragging, and has some advanced options that help out a lot. System files usually can't be defraged, but you can run a "boottime frag" which defrags the entire drive including the system files. This can help with actual OS speeds, as well.

Download : http://www.majorgeeks.com/download809.html
Info : http://www.majorgeeks.com/download809.html

Good luck!

EdCompSci
04-30-2006, 09:05 PM
yeah I might try that. It would be convenient to do this just for myself, but more than that I would just like to see how I can use VBA to do some kind of task with an application other than what is in Microsoft Office. I have VB6.0 LE only (for VB; for other languages I have VC5.0, JDK,Activeperl,...) I'll see how it works. The Diskeeper Lite was kinda cool to look at but not really what I wanted. I would like to see the on boot system file defrag though, that sounds interesting.

Howard Kaikow
05-23-2006, 01:00 PM
Hi Edward,

I find the windows defrag won't work if you're trying to do something, it tends to restart over and over. Not only that, it's really slow and doesn't do a very good job of defragmenting at all...

Try Diskeeper (http://www.executive.com/downloads/menu.aspx) (30 day free trial - then pay. Alt: see if you can find a download for the free Diskeeper Lite). Diskeeper will defrag in the background and you can schedule it to run when there's a period (choose your own period) of inactivity.

There's other defrags out there, but in my experience the inbuilt windows one is the worst of them all :)

Regards,
John

Perfect Disk is much better than Diskkeeper.
Read the stuff at http://www.perfectdisk.com/products/perfectdisk2k/wp.cfm.

Howard Kaikow
05-23-2006, 01:02 PM
You might also look into O&O Defrag Professional. It seems to do a very good job defragging, and has some advanced options that help out a lot. System files usually can't be defraged, but you can run a "boottime frag" which defrags the entire drive including the system files. This can help with actual OS speeds, as well.

Download : http://www.majorgeeks.com/download809.html
Info : http://www.majorgeeks.com/download809.html

Good luck!

Perfect Disk is better than O & O Defrag.

Howard Kaikow
05-23-2006, 01:06 PM
Hi Edward,

I find the windows defrag won't work if you're trying to do something, it tends to restart over and over. Not only that, it's really slow and doesn't do a very good job of defragmenting at all...

Try Diskeeper (http://www.executive.com/downloads/menu.aspx) (30 day free trial - then pay. Alt: see if you can find a download for the free Diskeeper Lite). Diskeeper will defrag in the background and you can schedule it to run when there's a period (choose your own period) of inactivity.

There's other defrags out there, but in my experience the inbuilt windows one is the worst of them all :)

Regards,
John

Fergot to mention, background defragging is an awful idea and should never be used.

Indeed, Perfect Disk was wise enough to not even include such a silly option.

Perfect Disk has a tool that will do a background Trend Analysis.
Using that info, you can decide when and how often to defrag particular drives. Raxco also provides an Access database with built-in queries that can be hooked to the Trend Analysis.

PC509
05-23-2006, 01:19 PM
Fergot to mention, background defragging is an awful idea and should never be used.

Indeed, Perfect Disk was wise enough to not even include such a silly option.

Perfect Disk has a tool that will do a background Trend Analysis.
Using that info, you can decide when and how often to defrag particular drives. Raxco also provides an Access database with built-in queries that can be hooked to the Trend Analysis.
Alright, let's see your business card, Mr. President of Perfect Disk...! ;)

I'm looking into PD as I type. It looks pretty good. I might give it a try. :) Always nice to find a new piece of software and give it a go! Thanks!

My first response to your posts were going to be: Why is it better?! But, that last one did go into more detail. Thanks!

Howard Kaikow
05-23-2006, 02:26 PM
Alright, let's see your business card, Mr. President of Perfect Disk...! ;)

I'm looking into PD as I type. It looks pretty good. I might give it a try. :) Always nice to find a new piece of software and give it a go! Thanks!

My first response to your posts were going to be: Why is it better?! But, that last one did go into more detail. Thanks!

As of few daze ago, the best price was at amazon.

Note that the raxco web site has a price search that gives the lowest prices, but, there's my big butt again, one should visit each vendors web site to see if there's also a rebate.

I got lucky and purchased when there was a $20 rebate, if purchased from amazon, but that expired last month.

However. amazon still has a far lower-price, I know knot y.

EdCompSci
05-26-2006, 10:27 PM
Yeah The O&O is impressive. I'll do a search for the PD when I get a chance. thanks everyone.

Howard Kaikow
05-29-2006, 02:33 AM
Yeah The O&O is impressive. I'll do a search for the PD when I get a chance. thanks everyone.

PD is better. See http://www.perfectdisk.com/products/perfectdisk2k/wp.cfm.