Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Batch file to de-fragment, backup, then shutdown?

08 Apr 2012   #1

Windows 7 Home Premium SP1 x64
 
 
Batch file to de-fragment, backup, then shutdown?

Hey guys,

Is there a way I can create a batch file so de-fragment my hard drive, once that has finished, backup to an external hard drive, and then one that has finished shut down the PC?

Thanks,

JPiiONEFOURONE


My System SpecsSystem Spec
.

08 Apr 2012   #2

Microsoft Community Contributor Award Recipient

Windows 7 Ult. x64 Windows 8.1 x64
 
 

Hi,

The first two are easy enough, but I've had some trouble getting a SHUTDOWN to happen after a backup has run - it seems to execute the shutdown during the other commands.

For the defragmentation and backup, try this - lets assume you want to backup from E:\Work and E:\Music to Z:

Code:
defrag E: /U /V
robocopy E:\Work Z:\Backup\Work /E /MIR /R:3 /W:10
robocopy E:\Music Z:\Backup\Music /E /MIR /R:3 /W:10
To see more help with these commands, in a CMD window type:
Code:
defrag /?
robocopy /?
shutdown /?
And some light bedtime reading:
ROBOCOPY - Create Backup Script

Regards,
Golden
My System SpecsSystem Spec
08 Apr 2012   #3

Windows 7 Ultimate x64
 
 

Maybe prepending the last robocopy command with start /wait would prevent that shutdown before the backup is finished.
My System SpecsSystem Spec
.


Reply

 Batch file to de-fragment, backup, then shutdown?




Thread Tools



Similar help and support threads for2: Batch file to de-fragment, backup, then shutdown?
Thread Forum
Solved How to run a batch file at logoff & some batch scripting help please Backup and Restore
Protected Folders Batch File Backup Backup and Restore
Solved Batch File that grabs file names from folder to insert into batch file General Discussion
Creating .batch to run at shutdown Performance & Maintenance
Remote Shutdown advanced Batch Job Network & Sharing
Shutdown PC w/ batch file (1hour) after program(game) launched Chillout Room
Solved Auto shutdown batch file help General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 05:43 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33