twig123 Posted September 29, 2008 Share Posted September 29, 2008 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 DefragmenterI'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 More sharing options...
acolwill Posted September 30, 2008 Share Posted September 30, 2008 Have a look at this:@echo offset report=%systemdrive%\Maintenance.logfor %%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 schedulerIn 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 More sharing options...
twig123 Posted September 30, 2008 Author Share Posted September 30, 2008 Thanks, I'll try this out later Link to comment Share on other sites More sharing options...
fdv Posted September 30, 2008 Share Posted September 30, 2008 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 DefragmenterJKDefrag, 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now