Defrag and Automatic Shutdown in XP Home - How?

  Tim Piggott 14:05 28 Jan 05
Locked

Does anone know how I can get to run defrag and then have the computer shutdown on its own when finished. As far as I can tell this is possible in XP Pro but not XP Home edition. Am I right or has someone come up with a way.

My Nero disc burning software has a tick box "Shut PC down when finished". Is there something like this for defragging?

My PC is in my bedroom - so I would like to leave it running and not have to wake up later to tun it off!

  JaßîsFaß ˜ 15:21 28 Jan 05

Here's an article I used on scheduling defrags click here

I can't remember if their is an option to run at shutdown in the scheduled task settings. Will see if I can find anything more on automating a defrag when you shutdown.

  JaßîsFaß ˜ 15:31 28 Jan 05

I believe this maintenance includes running a defrag during shutdown - have a read and see what you think

click here

  GroupFC 15:36 28 Jan 05

Just want to keep my eye on this one - as I'm intersted too!

  Tim Piggott 17:33 29 Jan 05

Thanks everyone for all your help - I can now share the solution . . . the following is copied from a text file that I have saved to explain to myself in the future how I did it (lest we forget . . . !)

Defrag and Shutdown in Windows XP Home Edition

The following is my Defrag and Shutdown Batch File (defragshutdown.bat) created with notepad - I have a shortcut to it in my quick launch toolbar:


defrag C: /v
defrag D: /v
defrag E: /v
Shutdown -t 20 -s -c "Defrag Complete!"


Explanation:

the -v switch enables a full analysis report
the repeated defrag command for C,D, & E enables all three of my harddrive partitions to be defragmented.
the -t 20 switch creates a 20 second delay before shutdown begins.
the -s switch is the command to execute the shutdown.
the -c switch allows me to put a comment into the shutdown warning box and is displayed for the 20 seconds.

The batch file could be as simple as:

defrag c:
shutdown -s

The following are the various switches that affect DEFRAG

-a Analyze only

-f Force defragmentation even if free space is low

-v Verbose output

-? Display this help text

The following are the various switches that affect SHUTDOWN

No args Display this message same as -?)

-i Display GUI interface, must be the first option

-l Log off (cannot be used with -m option)

-s Shutdown the computer

-r Shutdown and restart the computer

-a Abort a system shutdown

-m \\computername Remote computer to shutdown/restart/abort

-t xx Set timeout for shutdown to xx seconds

-c "comment" Shutdown comment (maximum of 127 characters)

-f Forces running applications to close without warning

-d [u][p]:xx:yy The reason code for the shutdown u is the user code p is a planned shutdown code xx is the major reason code (positive integer less than 256) yy is the minor reason code (positive integer less than 65536)

  Tim Piggott 17:38 29 Jan 05

Sorry - it didn't display as it should have the commands should have been each on a new line (hope this works!):

defrag C: /v
defrag D: /v
defrag E: /v
Shutdown -t 20 -s -c "Defrag Complete!"

  Tim Piggott 17:39 29 Jan 05

defrag C: /v

defrag D: /v

defrag E: /v

Shutdown -t 20 -s -c "Defrag Complete!"

  Tim Piggott 17:41 29 Jan 05

having trouble with getting new lines in the post - so if you have problems following what I put - email me!

Thanks again - Tim

  GroupFC 20:22 30 Jan 05

Thanks for posting that - when I'm feeling brave (I still consider myself a novice!) I'll give it a go.

  JaßîsFaß ˜ 10:47 31 Jan 05

:)

This thread is now locked and can not be replied to.

Surface Pro (2017) vs Surface Pro 4

Where HTML5 is headed next

MacBook Pro v Surface Pro 5