Schedule Tasks Before Shutdown

Does anyone know of a way I could have my computer perform a disk cleanup and a drive defrag before shut down?

In other words, whenever I click shutdown my computer I would like a disk cleanup and then a disk defrag performed before the system shuts down. When those two tasks are completed then shut the system down.

Is there any way for me to do this?? :(

#14544

Why not try it the other way round?

Instead of trying to detect when you click shut down and then perform disk cleanups etc, use a script or a program that will perform cleanup, wait to finish, defragment, and when it's done shut down the computer.

That would be much easier to implement.

Have a nice day!

Ken

#14690

True. You are right. That would be much easier! Thanks for the tip. But then, how can I get ObjectBar to execute that script when I want to shut down my computer. Because I want that to happen whenever I shut down my computer.

Also, the defragmenting and diskcleanup tools in windows have to be started with a button click before they will run. I dont want to have to click anything else. I just want to press shut down and have it do its thing, and then shut down.

Do you know of any defragging and/or diskcleanup tools that run as soon as they are executed with no extra clicking go or start or anything? I really need those programs, because without those, it is impossible for me to do this no matter how I go about it.

Thanks. ;)

#14697

You can defrag your drive using "defrag.exe c:" (or any drive letter). This doesn't require any further clicks from you. On the other hand, you don't get any visual feedback at all until the defragmentation finishes.

As for disk cleanup, I haven't found any command line parameters that would automate the process. You could include in the script deleting of C:\temp (or whatever your temporary folder is), empty recycle bin, etc.

I don't know much about ObjectBar but maybe you should instruct it to run your shutdown script instead of performing normal shutdown process.

Good luck!

Ken

#14709

Yes, thank you for the good ideas! Also defrag.exe rules!!

#14763