Auto Defrag & Shutdown

This is a little bat file I made that I use quite a bit on my systems and on customers.

The bat file defrags the C: drive and once it is done then shuts down the system. For some customers I have this scheduled in the windows task scheduler to run at midnight.
They leave their systems on when they leave the office, the system backs up and then at midnight it defrags and shuts down.

Why would you need this? Well besides from the example above here is why I use it. I'm about to head to bed, its late, and so I double click on the bat file, turn off my monitor and go to bed.
My computer will now be defragging and then power off (I turn my system off when I don't use it) So now I don't have to sit and wait for the defrag and it happens while I sleep.

Anyways I thought I would put this little file out for people who could use it and for the geek out there looking for a way of doing something similar and they can use this as an example.

The bat file looks like so:

start /wait %systemroot%\system32\defrag.exe C:

start %systemroot%\system32\SHUTDOWN.exe -s -f -t 30



As you can see simple as can be. Enjoy!