Bad command broke Windows somehow

First of all I’m using Windows 7 x64. I wanted to defrag my computer and have it turn itself off while I was asleep so after searching the internet I found something and modified it to this batch file:
start /wait %systemroot%\system32\defrag.exe /C /H /X /U
start %systemroot%\system32\shutdown.exe /s /t 30
When I ran it everything seemed to be fine but the next time I turned it on Windows wouldn’t get to the login screen, just black screen and mouse cursor. I had to go into safe mode and restore to 3 days earlier now everything is back the way it was. I’m wondering what went wrong though ’cause I still have fraggy disks. Even though I don’t think my E disk would’ve been affected by the restore (C is system volume/disk) it’s not defragmented.
Can anyone tell me what went wrong and maybe upgrade my batch file. Ideally I’d like the best defrag that defrag can do and maybe print logs to a file in case something goes wrong again.
Thanks.
Here are the descriptions of the parameters for each program from the programs:
Quote
/C Peform the operation on all volumes.
/H Run the operation at normal priority (default is low)
/X Perform free space consolidation on the specified volumes.
/U Print the progress of the operation on the screen /s Shutdown the computer.
/t xxx Set the time-out period… 30 is default. /f (force shutdown) is implied by this.

0 comments: