How to automate Defrag, Disk Cleanup, Reboot R R




By: Richard (August 7, 2007)

Clear the Temporary Internet Files using the Windows XP Disk Cleanup utility

Defragmenting a hard drive, combined with clean up of Temporary Files keep your computer running fast. It'd be nice to configure your computer to carry out these tasks automatically without you lifting a finger.

  • Click Start, Run

  • Type the following: cleanmgr.exe /d C: /sageset:50

    • C: is the drive containing your Windows installation.

    • :50 is a label that identifies this particular config. It can be any integer value from 0 to 65535.

      • Look at it in terms of having the ability to configure cleanmgr.exe many different ways, and you can create a Task in Task Scheduler to run each variant at a different time of your choice. If you don't understand what I just said, just read on.

    • The command cleanmgr.exe /d C: /sageset:50 opens a Disk Cleanup Settings window. Check whatever you want to clean up.

  • Click OK.
    • Your config is now saved in the registry, and identified by the label :50.

    • To run it, just do Start, Run, and type C:\WINDOWS\system32\cleanmgr.exe /sagerun:50

      • Let's say for cleanmgr.exe /d C: /sageset:50, you only put checkmarks in "Temporary Internet Files" and "Temporary Setup Files". You can create another config, e.g. cleanmgr.exe /d C: /sageset:51, and check other options, e.g. "Downloaded Program Files". To run it, you would issue the command C:\WINDOWS\system32\cleanmgr.exe /sagerun:51.

      • cleanmgr.exe /d C: /sagerun:50 will clean "Temporary Internet Files" and "Temporary Setup Files".

      • cleanmgr.exe /d C: /sagerun:51 will clean only "Downloaded Program Files".

How to automate Disk Cleanup

  • Start, All Programs
  • Accessories, System Tools
  • Scheduled Tasks
  • Add Scheduled Task
  • Next
  • Disk Cleanup, Next
  • Type a name for the task, e.g. "Disk Cleanup".
  • Select how often to run
  • Next
  • Configure Start time
  • Check day(s)
  • Next
  • Enter password, and re-type password.
  • Next
  • Check Open advanced properties
  • Finish
  • Under Run:, enter one of the above configs, e.g. "C:\WINDOWS\system32\cleanmgr.exe /sagerun:50"
  • Enter password again if asked.

How to automate Defrag

  • Create a Scheduled Task as above.
  • Under Run:, enter C:\WINDOWS\system32\defrag.exe C:.
    • C: is the drive to defrag.

How to automate System reboot

  • Create a Scheduled Task as above.
  • Under Run:, enter C:\WINDOWS\system32\shutdown.exe -r -t 01.

You can combine all three above to your advantage. E.g.

  • Create a scheduled task to clean up temp files at 12:30 am.
  • Then another scheduled task to defrag at 3:00 am.
  • Finally, a scheduled task to reboot the machine at 8:00 am.

Doing this will give you a fresh machine to work with each morning. Although a daily defrag may be overkill. Personally, I clean up temp files daily, then reboot. I do Defrag once a week.

Detect and repair disk errors

In addition to running Disk Cleanup and Disk Defragmenter to optimize the performance of your computer, you can check the integrity of the files stored on your hard disk by running the Error Checking utility.

As you use your hard drive, it can develop bad sectors. Bad sectors slow down hard disk performance and sometimes make data writing (such as file saving) difficult, or even impossible. The Error Checking utility scans the hard drive for bad sectors, and scans for file system errors to see whether certain files or folders are misplaced.

If you use your computer daily, you should run this utility once a week to help prevent data loss.

To run the Error Checking utility:

  1. Close all open files.
  2. Click Start, and then click My Computer.
  3. In the My Computer window, right-click the hard disk you want to search for bad sectors, and then click Properties.
  4. In the Properties dialog box, click the Tools tab.
  5. Click the Check Now button.
  6. In the Check Disk dialog box, select the Scan for and attempt recovery of bad sectors check box, and then click Start. Image of Check Disk dialog box
  7. If bad sectors are found, choose to fix them.
Tip: Only select the "Automatically fix file system errors" check box if you think that your disk contains bad sectors.

Speed Up Processing Time

  1. Turning off the fancy Windows XP graphics will noticeably increase the speed of your computer.
  2. Go to Start, (Settings), Control Panel, System. NOTE: You may need to 'Switch to Classic Mode' to see the System applet.
  3. Go to the Advanced tab. Click the Settings button under Performance.
  4. Select the 'Adjust for best performance' radio button, then Apply, and OK.
  5. The graphics aren't as flashy, but your computer will run a lot faster.

Make Windows load faster

Windows by default is configured to wait 30 seconds before bootup. You can cut this wait time down for a faster boot as follows:

  1. Click Start, then Run.
  2. Type in 'msconfig' and press enter.
  3. Click on the BOOT.INI tab at the top.
  4. Over to the right there will be a box labeled Timeout with 30 in it. Change the 30 to a 3.

Make Windows run faster

Disable File Indexing:

  1. Double click on My Computer.
  2. Right click on the C: drive.
  3. Select Properties.
  4. Uncheck the box next to "Allow Indexing Service to index this disk for fast file searching".
  5. Select the bullet next to "Apply changes to C:\, subfolders and files", and press OK.
  6. If any warning/error messages appear (e.g."Access is denied"), click the Ignore All button. Don't worry.

Make Windows run faster

Empty the Windows Prefetch folder every month or so.

  1. Create a new file: clean_prefetch.bat
  2. Enter the following in the file:
    del /F/Q %systemroot%\prefetch\*.*
  3. Save the file in C:\Documents and Settings\USERNAME\My Documents
  4. Now create a Scheduled Task to run clean_prefetch.bat periodically.

Make Windows run faster

Empty the Windows Prefetch folder every month or so.

  1. Create a new file: clean_prefetch.bat
  2. Enter the following in the file:
    del /F/Q %systemroot%\prefetch\*.*
  3. Save the file in C:\Documents and Settings\USERNAME\My Documents
  4. Now create a Scheduled Task to run clean_prefetch.bat periodically.

Misc.

  1. Disable unnecessary services: http://www.blackviper.com/WinXP/servicecfg.htm
    http://www.masternewmedia.org/news/2006/04/12/slow_computer_speed_up_your.htm
  2. Useful Free Windows Programs:
    http://revision3.com/forum/showthread.php?t=234
    http://www.talkaudio.co.uk/vbb/showthread.php?t=179940
  3. http://virt-dimension.sourceforge.net/
  4. Virtual desktop manager: http://virt-dimension.sourceforge.net/
  5. System info for Windows: http://www.gtopala.com/siw-download.html
  6. System Diagnostics (SiSoft Sandra).

Faster Boot up time

  1. Go to start then run and type regedit
  2. Browse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControl Set\Control\ContentIndex
  3. On the right, scroll all the way down to the bottom and you should find something called StartupDelay
  4. Double click on it and you will get a pop-up box, tick decimal and you should have a value of 480,000
  5. Change the 480,000 to 40,000 and then restart.

Faster Boot up time: Prefetcher

  1. Go to start then run and type regedit
  2. Browse to:
    HKLM\System\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters\EnablePrefetcher
  3. set the following value in the registry to a value of 2.

Disable Paging

If you have 1GB of memory or more,

  1. Go to start then run and type regedit
  2. Browse to:
    HKLM\System\CurrentControlSet\Control\Session Manager\Memory Management
  3. Double-click the value name DisablePagingExecutive and change the value data to 1.

Disable Java quick starter

  1. Open control panel
  2. Double click Java
  3. Click Advanced tab
  4. Click Miscellaneous
  5. Uncheck Java quick starter

Removing Negative DNS Cache Entries

If you have 1GB of memory or more,

  1. Go to start then run and type regedit
  2. Browse to:
    HKLM\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters
  3. Edit -> New -> DWORD Value.
  4. type MaxNegativeCacheTtl
  5. Press Enter twice and give MaxNegativeCacheTtl a value of 0.
  6. Reboot.
Set system to delete both pagefile.sys and hiberfil.sys on shutdown

http://www.theeldergeek.com/group_policy_editor.htm

  1. open command prompt
  2. Type gpedit.msc
  3. Windows Settings -> Security Settings -> Local Policies -> Security Options -> “Shutdown: clear virtual memory pagefile”
  4. set the value to "enabled".

Copyright © 2000-2022 Richie's Tutorials All rights reserved.