Compu-Docs Computer Repair & Services for NJ New Jersey Businesses & Home Users |
Windows 2000 and XP have a built in defragmenter program, which is based on the popular Diskeeper software from Executive Software. The full version of Diskeeper will allow you to defrag remote disks, defrag your page file during bootup and it also has a built in scheduler feature. Those features are not available from the version that is included with Windows 2000. Microsoft even states in it's Knowledge Base article Q227463 that the Defragmenter program for Windows 2000 cannot be scripted to run scheduled defrags. That's true up until now. A Google search turned up This Article at Windows & .Net Magazine. The code available for download there needs to be saved with a .vbs file extension and will only do 1 drive (your C: drive). I've added to the code to Defragment additional drives as follows. Windows XP is a little more user friendly in that it does have a command line feature (Defrag.exe) so, administrators can write scripts to run it at will or to schedule it to run during off hours. The vbs files below are for Windows 2000 and the bat (batch) files are for Windows XP. The files are in zip format for downloading. The script between the horizontal lines below for Windows 2000 can be copied and pasted into Notepad and saved as Defrag.vbs or any name you wish. I've named my scripts Dfrg1prt.vbs through Dfrg4prt.vbs for Windows 2000 and Dfrg1prt.bat through Dfrg4prt.bat for Windows XP You then can use Scheduled Tasks in Control Panel to run for example Dfrg1prt.vbs (for 1 W2K partition) or Dfrg1prt.bat (for 1 XP partition) at a convenient time. You can also just create a desktop shortcut to the file to start Disk Defragmenter at any time you wish. The vbs files have been tested on the final English versions of Windows 2000 Pro and Server only. The bat files have been tested on the final English versions of Windows XP Home & Pro The version shown between the horizontal lines below for Windows 2000 only, will defrag 4 partitions. If you just copy the black text including the last 2 End commands, it will defrag just the C: partition. If you copy the black & blue text, it will defrag the C: & D: partitions. If you copy the black, blue & red text, it will defrag the C:, D: & E: partitions. If you copy the black, blue, red & green text (the whole script), it will defrag the C:, D:, E: & F: partitions. Save your text file with whatever name you wish and then rename it so it has a .vbs file extension. By using this code or the files available for downloading you agree to the Warranty Disclaimer WARRANTY DISCLAIMER DISCLAIMER OF WARRANTY IN NO EVENT SHALL THE AUTHOR BE HELD LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS OR PERSONAL INFORMATION, OR ANY OTHER LOSS ARISING FROM THE USE OR INABILITY TO USE THE SOFTWARE. Or you can also download one of the following completed scripts if you agree to the Warranty Disclaimer. WINDOWS 2000 SCRIPTS Note: Unzipping the following files will create a Defrag folder. Inside the folder is the script and a shortcut (you can copy the shortcut to your Desktop if you so desire). Place the Defrag folder at the root of your C: drive for the shortcut to work properly. For one Windows 2000 partition (C drive only) Defrag2K1Part.zip 1KB I Agree For two Windows 2000 partitions (C & D drives only) Defrag2K2Part.zip 1KB I Agree For three Windows 2000 partitions (C, D & E drives only) Defrag2K3Part.zip 1KB I Agree For four Windows 2000 partitions (C, D, E & F drives only) Defrag2K4Part.zip 1KB I Agree You can also use the NEW! AUTODEFRAG.EXE executable file found below. WINDOWS XP SCRIPTS Note: Unzipping the following files will create a Defrag folder. Inside the folder is the script and a shortcut (you can copy the shortcut to your Desktop if you so desire). Place the Defrag folder at the root of your C: drive for the shortcut to work properly. For one Windows XP partition (C drive only) DefragXP1Part.zip 1KB I Agree For two Windows XP partitions (C & D drives only) DefragXP2Part.zip 1KB I Agree For three Windows XP partitions (C, D & E drives only) DefragXP3Part.zip 1KB I Agree For four Windows XP partitions (C, D, E & F drives only) DefragXP4Part.zip 1KB I Agree You can also use the NEW! AUTODEFRAG.EXE executable file found below. NEW! AUTODEFRAG.EXE PROGRAM: Thanks goes to Bob Askey for taking the code from this page and creating an executable file which automatically figures out how many partitions you have. It works on both Windows 2000 Pro & Server and Windows XP Home & Pro. A plus for XP users is that it runs the GUI version of Disk Defragmenter rather than the command line version. There are only 2 bugs found in the Autodefrag.exe program. One is if the computer has a hidden partition (Dell uses a hidden partition), the last partition will be defragmented twice, which is no big deal. The other is if you have memory card readers, thumb drives or memory sticks that show up as drives in My Computer or Windows Explorer, then the last partition will be repeatedly defragmented by the number of extra drive letters. In any case it will finally get to defragmenting the C: drive. Note: Unzipping the following files will create a Defrag folder. Inside the folder is the executable file and a shortcut (you can copy the shortcut to your Desktop if you so desire). Place the Defrag folder at the root of your C: drive for the shortcut to work properly. For Windows 2000 and XP, Download AutoDefrag.zip 9KB I Agree NOTE FOR ALL USERS: Use either Scheduled Tasks in Control Panel and browse to the file to schedule the program to run or create a desktop shortcut to the file to run it any time you wish. You can also just put the script itself on your desktop and run it from there. You should not run these scripts with any other application running in the foreground at the same time. For example, if you double click the file in Windows Explorer, then Windows Explorer may pick up some of the keystroke commands and cause the script not to run properly. So make sure nothing else is running (viewable) on your desktop when you run the script. The best way to do this is to create a shortcut to the file or use Scheduled Tasks. Also please note that Disk Defragmenter requires a person with administrator rights to run it. NOTE FOR ALL WINDOWS 2000 USERS: The file ShellIconCache frequently gets fragmented and is not defragged by Disk Defragmenter. You can defrag it beforehand by running the batch file Shell.bat, which I have zipped into Shell.zip. For Windows 2000 Only, Download Shell.zip 1KB I Agree NOTE FOR WINDOWS 2000 ADMINISTRATORS: Do you want a regular user to be able to run the scripts? Click Here. NOTE FOR ANTI-VIRUS USERS: When users running Norton Anti-Virus run any kind of vbs (script) file, an Alert warning box may pop up. For the "Action:" you should choose "Authorize this script" from the drop down menu. In the future, when you run the script, you will not receive the Alert warning box again. Other Anti-Virus programs may also prompt you to allow the scripts to run.
WINDOWS 2000 SCRIPT FOR 4 PARTITIONS IS SHOWN BELOW: 'This script launches defrag and sends keys to the UI in order to automate the defrag
You Are visitor number to this Web page. |
All
trademarks used are properties of their respective owners. Last modified: June 19, 2014 |