PDA

View Full Version : Setting up your Computer to Automatically Defragment itself (Windows)



BmB
12th Jan 07, 1:43 PM
So, you're tired of defragmenting every week or so to prevent your computer from loosing performance to fragments? You don't have the will or money to buy software that can do this automatically for you? Or had bad experiences with free software that claims to do this?

Do not dispair, you can do this in Windows with only one download and a few steps to set up things right.

First you'll want to download PageDefrag (http://www.microsoft.com/technet/sysinternals/Utilities/PageDefrag.mspx). This utility is important because it can defrag things like your page-file and registry, things that are usually constantly occupied by Windows and not reachable by conventional software. It can do this by defragging the areas before Windows use them. Some premium software can do the same thing, but then you'd have to pay for it.

It's very simple to set up PageDefrag, you extract it to somewhere out of the way, as you won't need to start it again. (my personal preference is in '/Documents and Settings/User') Then you start it and select "Defragment at every boot" and configure the amount of seconds you'd like to have to abort it. I recommend 0 seconds, other settings are just a waste of time, because when you've used it a couple of times, the total amount of extra boot time is a second or so. In the beginning, however, it may take a while because these areas have never been defragged before.

Now to set up defragmentation of the rest of the harddrive:

Open up notepad or some other simple text editor, type the following: 'defrag C:' (without quotes) if you have more than one hard drive, type the other drive letters too. Like so:
'defrag C:;D:;E:' etc. (again without quotes)

Save it as a .cmd file. (or .bat, but I like to use cmd because it's for one task, not multiple) Once again, somewhere out of the way, like where you put PageDefrag.

Now, to make the command execute at every boot.
Open up Control Panel, navigate to (Maintenance is it? I don't know what it's called in English, but the one with the pie-diaphgram icon.) alternately, if you use the classic control panel, just open planned tasks, or task planning or something similar. (English again)

Plan a new task.

Follow the guide, in the second step (or first, depending on how you count the steps), click 'browse' and navigate to the .cmd file. (or .bat)
in the next step, select the second option from the bottom. (when my computer boots, starts, or something similar)
Finsih the remaining steps in the guide.

You now never have to worry about defragmentation again. Be wary though that it'll slow your boot time considerably the first few times, and if you have a slower system the boot time .cmd may give you an extra minute of logon time.

This tutorial is primarily for Windows XP, I am not sure wether it'll work on Windows 98 or ME, but I imagine that 2000 will work out fine. NT is a possibility, but it's so old that I frankly don't know.

It is also for the not-so-tech-savvy in particular. Since I imagine the tech-savvy can figure this out on their own quite fine.

This is now useless as Windows Vista and upwards already does this. And you will never reboot Vista if you know how to use sleep anyways. And sys-internals Vista compatibility is questionable.

Homdax
15th Jan 07, 4:09 AM
Or set the page file to be deleted every boot, hence Windows will create a new, unfragmented page file, every boot. (Also a safety thing to prevent file access if computer is stolen.)

Do like this using Microsoft Management Console (MMC) in WINXP Pro:

Start >
Run >
"mmc" >
Menu >
File >
Add/Remove Snap-in (first new window opens) >
Add (second new window opens) >
Select: Group Policy Object Editor (third new window opens)>
Don't change "Local Computer" >
Finish (closes third window) >
Close (closes second window) >
OK (closes first window).

That gives You "Local Computer policy" in the MMC root.
Browse to:
Computer Configuration >
Windows Settings >
Security Settings >
Local Policies >
Security Options >
(in the pane) Shutdown: Clear virtual memory file > Enable.

Shutdown will take a few seconds longer from now.

Exit the MMC, unless You want to review other stuff CAREFULLY (you may save the console layout with selected snap-in if you like).

About defragging the registry I am not sure its useful. I do know its dangerous.

tyrion
10th Oct 08, 2:39 PM
Probably me being a little stupid here but I don't get "Group Policy Object Editor" as an option anywhere...

Homdax
11th Oct 08, 11:48 AM
WINXP Pro?
BmB and I was talking about that.

Could that be why?

I later found a shortcut via Control Panel > Administrative Tools > Local Security Policy.

Open it and browse to Local Policies > Security Options >in the list see image

http://www.hwaccess.net/images/clearpagefile.png