Jump to content

XP Auto Defrag


Recommended Posts

Hey all,

I'm sure this has been discussed before, but I was not able to find a viable solution.

I am looking to Auto-Defrag the C: drive of a computer... using the built-in Disk Defragmenter

I'm not sure the best way to do this. I've tried to use the "AutoDeFrag" utility from SourceForge, however, it is shotty and either does nothing or just opens the defrag window and I have to manually click defrag. I tried to create a scheduled task through a Batch file run the defrag every Wed. at 11am., however, it requires a username/password (Which is different on each of my systems) and won't run without those credentials.

So, does anyone know of a batch/vbs or otherwise that will allow me to do an Auto-Defrag, and be able to make a scheduled task that would work without the need to authenticate credentials to start?

Thanks in advance

Link to comment
Share on other sites


Have a look at this:

@echo off

set report=%systemdrive%\Maintenance.log

for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:\nul (
for /f %%a in ('net use ^| find /c /i "%%i:"') do if "%%a"=="0" (
for /f "tokens=3 delims= " %%b in ('dir %%i:\ ^| find /i "bytes free"') do if not "%%b"=="0" (

echo. >> %report%
echo -------------------------------------------------------------- >> %report%
echo DEFRAGMENTING DRIVE %%i:\ >> %report%
echo -------------------------------------------------------------- >> %report%

defrag %%i: -v | find /v /i "copyright" | find /v /i "Windows Disk Defragmenter" >> %report%
echo. >> %report%
)
)
)

Save that as a CMD file, wherever you choose.

Add this to the task scheduler

In order to have a task scheduled to run, you HAVE to supply credentials, PERIOD. There is no way around this, unless you manually execute the program/instructions at a given time.

Link to comment
Share on other sites

Hey all,

I'm sure this has been discussed before, but I was not able to find a viable solution.

I am looking to Auto-Defrag the C: drive of a computer... using the built-in Disk Defragmenter

JKDefrag, which uses the built-in Windows defrag engine, has a defrag screensaver bundled with it.

(Sure, any .exe changed to .scr will work, but this is designed for it).

Link to comment
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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...