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

JPiiONEFOURONE

New member
Local time
2:28 AM
Messages
1
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 Computer My Computer

At a glance

Windows 7 Home Premium SP1 x64AMD Phenom II 965 BE8GB Corsair VengeanceAMD Radeon HD 6870 (MSI Hawk)
OS
Windows 7 Home Premium SP1 x64
CPU
AMD Phenom II 965 BE
Motherboard
Asus M4A89GTD-PRO
Memory
8GB Corsair Vengeance
Graphics Card(s)
AMD Radeon HD 6870 (MSI Hawk)
Sound Card
5.1 Surround Sound
Monitor(s) Displays
HANNS-G HZ194
Hard Drives
Samsung Spin Point F1 1TB
PSU
Corsair TX650W
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:
http://www.sevenforums.com/tutorials/187346-robocopy-create-backup-script.html

Regards,
Golden
 

My Computer My Computer

At a glance

Windows 10 Pro x64 ; Xubuntu x64Intel i7 860 @ 2.80 GHz O/C'ed to 4.0GHz16GB Corsair Vengance DDR3 @ 661 MHz Dual Cha...EVGA NVidia GTX 560 1024MB
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Golden Mk. I.4
OS
Windows 10 Pro x64 ; Xubuntu x64
CPU
Intel i7 860 @ 2.80 GHz O/C'ed to 4.0GHz
Motherboard
Gigabyte P55A-UD3R Rev.1. Award BIOS F13
Memory
16GB Corsair Vengance DDR3 @ 661 MHz Dual Channel (9-9-9-24)
Graphics Card(s)
EVGA NVidia GTX 560 1024MB
Sound Card
Realtek Integrated
Monitor(s) Displays
Dual Samsung SyncMaster 2494HS
Screen Resolution
1920*1080 and 1920*1080
Hard Drives
1*Samsung 840 EVO 120GB SSD;
1*OCZ Vertex 2 60GB SSD;
2*Samsung F3 SpinPoint 1TB in RAID0;
1*Samsung F1 SpinPoint 1TB;
2*Western Digital 1TB External USB 3.0
1*Western Digital 500GB External USB 3.0
1*Seagate 500GB External USB 2.0
PSU
Thermaltake ToughPower QFan 750W
Case
Thermaltake Element S VK60001W2Z
Cooling
Corsair H60 Water Cooling, 2*230mm and 2*80mm case fans
Keyboard
Logitech G110
Mouse
Logitech MX518
Maybe prepending the last robocopy command with start /wait would prevent that shutdown before the backup is finished.
 

My Computer My Computer

At a glance

Windows 7 Ultimate x64
OS
Windows 7 Ultimate x64
Back
Top