DOWNLOAD: Best tool to repair Windows problems & optimize system performance | Best driver update software for your PC
 
Page 1 of 2 12 LastLast
Results 1 to 10 of 17
Like Tree2Likes

Thread: Faster Method To Clean & Defrag Windows using Batch File

  1. #1
    Arun Kumar's Avatar
    Arun Kumar is offline MVP Alumni
    Join Date
    Aug 2012
    Location
    Hyderabad
    Posts
    98

    Default Faster Method To Clean & Defrag Windows using Batch File

    Until some time back I was using Smart Defrag to defragment my hard drive. It is a nice program but the problem I faced was it won't start on its own even I selected AutoDefrag. Probably because my CPU usage is always high owing to all the programs I keep running. The Windows Defragmentor is good and works well in Windows 7 unlike as in XP where it cause system to hang. Normally I would run CCleaner to remove junk off the hard disk before using any defragmentor so that clutter stays away while HDD is optimized for free space. But then, invoking both programs manually is something I would always forget.

    One option was to add them to task scheduler with a little time gap so that Ccleaner runs first and then, Defragmentor runs. But I could not find out a method to auto tune cleanup junk files in Ccleaner (is it possible to pass any parameters to it?). Same problem with defragmentor, I could not skip analyzing part to directly get the defrag working. And it seems we have to configure it first as to what all drives to defrag.

    I found a better way (at least in my opinion, it is good). I created a batch file that does:



    1. Cleans up all temp files from C drive
    2. Removes all log files from C drive
    3. Runs Defrag on C drive - first consolidates the free space and then defrags and then again consolidates free space.

    A little more work is required with this file to:
    1. find out folders containing data from browsers: cookies, form data, login data etc so that they can be deleted automatically
    2. find out useless files and folders created by Office 2010 applications so that they too can be removed automatically
    3. Make a list of other folders and file types that need not be present on my computer and include them in the delete list.

    As of now, it removes .temp; .tmp; and .log files before proceeding to defrag (command line command - advantage is that it offers some additional command over the defrag process when compared to its GUI counterpart). Here is a snap how my batch file looks like:



    So, it starts on its own, cleans, defrags and does a quick check on system files before exiting on its own.

    As far as I know, blindly removing all tmp/temp files should not affect the OS in any negative way. Since I am not much into reading log files, no harm in eliminating them as well? I will sit one day and figure out the other folders etc (though the /s switch with DEL should delete tmp files all over the C drive) that need to be cleaned on a timely basis. Now this batch file is added to Task Schedule and runs once a week w/o I having to initiate each action one by one.

    Your comments? I can share the file but am not sure if it is totally safe method.
    Will upload it somewhere once am convinced and add the other points I mentioned above. Meanwhile, if you can give any advice on improving it, please do.
    Last edited by Arun Kumar; 13th September 2012 at 17:14. Reason: warning
    HappyAndyK likes this.

  2. #2
    Condusiv is offline New Member
    Join Date
    Sep 2012
    Posts
    1

    Default Diskeeper

    Hi Arun,

    Are you aware of Diskeeper 12 by Condusiv Technologies? It removes and even prevents fragmentation at all times using only idle system resources - and never has to be "started."

    As an MVP, you are entitled to complimentary Condusiv Technologies software. Search Google for "condusiv mvp". I invite you try our software and see for yourself.

    -Alex
    Condusiv Technologies


    Quote Originally Posted by Arun Kumar View Post
    Until some time back I was using Smart Defrag to defragment my hard drive. It is a nice program but the problem I faced was it won't start on its own even I selected AutoDefrag.

  3. #3
    Arun Kumar's Avatar
    Arun Kumar is offline MVP Alumni
    Join Date
    Aug 2012
    Location
    Hyderabad
    Posts
    98

    Default

    Thank you Alex, I will check out the software.

  4. #4
    Arun Kumar's Avatar
    Arun Kumar is offline MVP Alumni
    Join Date
    Aug 2012
    Location
    Hyderabad
    Posts
    98

    Default

    While we are here, does the command SENDKEYS not work anymore under DOS? Windows simply neglects the command when used in a batch file.

  5. #5
    DustinH's Avatar
    DustinH is offline Senior Member
    Join Date
    Aug 2008
    Location
    Boardman, OR
    Posts
    243

    Default

    Looks good. Only thing, though, is that I wouldn't blindly delete .log files depending on what applications I had that used them. Great for a custom defrag utility, though. I like how you delete the temp files before a defrag - very smart!
    Arun Kumar likes this.

  6. #6
    Matrix's Avatar
    Matrix is offline Senior Member
    Join Date
    Jul 2009
    Posts
    431

    Default

    Honestly speaking, do I really need a 3rd party defragger, when the Windows 7 defragger is already so good?

  7. #7
    Arun Kumar's Avatar
    Arun Kumar is offline MVP Alumni
    Join Date
    Aug 2012
    Location
    Hyderabad
    Posts
    98

    Default

    Hi Matrix,
    There is no doubt Windows 7 defragger is good but the CLI command provides some visible features over the GUI one. For example, it allows me to conslidate the free space before and after the defragmentation that makes a good case for better defrag. I don't know if the GUI version has this feature though it does analyze the drives. Or you may call it just a matter of satisfaction
    Regards

  8. #8
    Arun Kumar's Avatar
    Arun Kumar is offline MVP Alumni
    Join Date
    Aug 2012
    Location
    Hyderabad
    Posts
    98

    Default

    Thank you, DustinH. I read somewhere that freeing up temp files before defrag allows for more contagious space allocation for fragmented files.

  9. #9
    zazo is offline New Member
    Join Date
    Nov 2012
    Posts
    4

    Default

    [QUOTE=Arun Kumar;166700]Until some time back I was using Smart Defrag to defragment my hard drive. It is a nice program but the problem I faced was it won't start on its own even I selected AutoDefrag. Probably because my CPU usage is always high owing to all the programs I keep running. The Windows Defragmentor is good and works well in Windows 7 unlike as in XP where it cause system to hang. Normally I would run CCleaner to remove junk off the hard disk before using any defragmentor so that clutter stays away while HDD is optimized for free space. But then, invoking both programs manually is something I would always forget.

    H Arun,
    Where is this batch, I am really interested to have it.
    Thank you

  10. #10
    Arun Kumar's Avatar
    Arun Kumar is offline MVP Alumni
    Join Date
    Aug 2012
    Location
    Hyderabad
    Posts
    98

    Default

    Quote Originally Posted by zazo View Post
    H Arun,
    Where is this batch, I am really interested to have it.
    Thank you
    It is on my SkyDrive as well: http://sdrv.ms/W5BrBJ. Right click and select download. After downloading, to view the contents, right click on the .bat file and select EDIT.

    You may want to remove the lines that delete all log files before using it. Again, am not sure of side effects. Am using it for months now w/o any problems.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22