I try to write a batch file which:
- Set one drive online
- Backup files
- Set drive back offline
I have a batch file that sets the drive online, one file taking it offline and a batch file that robocopys the files I want.
BUT
- I dont get them together. I have now three files and have to wait for one getting done to start the next one.
- robocopy isnt done til the drive is set offline again. I dont know how I get the offline command waiting for robocopy to be done.
File for drive online (.bat):
diskpart /s C:\Users\USERNAME\Desktop\FestplatteDiskpartON.txt
list disk
select disk 1
online disk
diskpart > exit
File for copy (.bat) / file :
robocopy D:\Tastaturen\ E:\ /MIR
File for drive offline (.bat):
diskpart /s C:\Users\USERNAME\Desktop\FestplatteDiskpartOFF.txt
"C:\Program Files\HDDScan\HDDScan.exe" "\\?\scsi#disk&ven_&prod_st2000dm008-2fr1#4&39693902&0&020000#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}" -APM 1 -PM 0 -Z
list disk
select disk 1
offline disk
I tried:
@ echo off
start /wait "" "C:\Users\USERNAME\Desktop\Festplatte online.bat"
:: Start BackupVorgang
start /wait "" "robocopy D:\Tastaturen\ E:\ /MIR"
diskpart /s C:\Users\USERNAME\Desktop\FestplatteDiskpartOFF.txt
"C:\Program Files\HDDScan\HDDScan.exe" "\\?\scsi#disk&ven_&prod_st2000dm008-2fr1#4&39693902&0&020000#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}" -APM 1 -PM 0 -Z
echo done
In this szenario backup doesnt work. "Cant find robocopy".
I also tried with timeout /x after setting online.
I dont know how I can get the batch file setting the drive online, THAN copy, wait for the copying done and than set the drive offline.