-
October 17th, 2009, 10:25 AM
#1
Batch Help
Hello.
For backups, I use DriveImage XML which runs from the Task Scheduler with this command: "C:\Program Files\Runtime Software\DriveImage XML\dixml.exe" /bC /t"D:\drive_c /s /l
I have a 2nd hard drive that has 2 partitions, "D" and "J". After the program runs, I change the command to read J:\drive_c /s /l so it alternates week to week. Is there a way to make the batch file change the drive letter automatically after each run?
Thank you.
Desktop: Dell I620. Win 7 Home Premium
Laptop 1: Toshiba, Win7 home premium
Laptop 2: Macbook Pro
-
October 17th, 2009, 01:27 PM
#2
An easier alternative would be to have a batch file for each drive, and a batch file that Task Scheduler uses. Then, have the last command in each batch file copy the next batch file in the rotation to the batch file used in Task Scheduler.
-
October 17th, 2009, 06:38 PM
#3
jdc2000. Thanks for the reply.
I don't think I quite understand this. The only file to run would be the one that task scheduler uses so how would the other 2 run? If I put a line in the task scheduler batch file to copy one of the other batch files, how would it know to alternate? Or, am I reading this wrong?
Thank you.
Desktop: Dell I620. Win 7 Home Premium
Laptop 1: Toshiba, Win7 home premium
Laptop 2: Macbook Pro
-
October 17th, 2009, 06:57 PM
#4
Can't you just have 2 batch files and schedule them to run every 2 weeks?
Task1 - batchD (week 1, 3, 5, etc)
Task2 - batchJ (week 2, 4, 6, etc)
-
October 17th, 2009, 08:50 PM
#5
Example:
Backup1.bat file contents:
C:\Program Files\Runtime Software\DriveImage XML\dixml.exe" /bC /t"D:\drive_c /s /l
copy Backup2.bat Backup.bat
Backup2.bat file contents:
C:\Program Files\Runtime Software\DriveImage XML\dixml.exe" /bC /t"J:\drive_c /s /l
copy Backup1.bat Backup.bat
In Task Scheduler, use Backup.bat as the file to schedule, and start with Backup.bat as a copy of Backup1.bat
-
October 18th, 2009, 07:58 AM
#6
Here's one that will alternate between D: and J: all by itself, as well as record the beginning and completed date and time, (which could come in handy):
Code:
@echo off
if not exist "C:\Program Files\Runtime Software\DriveImage XML\Last_Backup.txt" goto Backup2D
find "J:" "C:\Program Files\Runtime Software\DriveImage XML\Last_Backup.txt">nul
if errorlevel 1 goto Backup2J
:Backup2D
echo dixml.exe backup to D:\drive_c beginning on %date% at %time%>"C:\Program Files\Runtime Software\DriveImage XML\Last_Backup.txt"
"C:\Program Files\Runtime Software\DriveImage XML\dixml.exe" /bC /t"D:\drive_c /s /l
echo dixml.exe backup to D:\drive_c completed on %date% at %time%>>"C:\Program Files\Runtime Software\DriveImage XML\Last_Backup.txt"
goto End
:Backup2J
echo dixml.exe backup to J:\drive_c beginning on %date% at %time%>"C:\Program Files\Runtime Software\DriveImage XML\Last_Backup.txt"
"C:\Program Files\Runtime Software\DriveImage XML\dixml.exe" /bC /t"D:\drive_c /s /l
echo dixml.exe backup to J:\drive_c completed on %date% at %time%>>"C:\Program Files\Runtime Software\DriveImage XML\Last_Backup.txt"
:End
After it has run, see the file "C:\Program Files\Runtime Software\DriveImage XML\Last_Backup.txt" for the results.
-
October 18th, 2009, 11:48 AM
#7
Thank you all very much for the replies. Very informative. I've learned something today.
Desktop: Dell I620. Win 7 Home Premium
Laptop 1: Toshiba, Win7 home premium
Laptop 2: Macbook Pro
-
October 18th, 2009, 07:18 PM
#8
You're welcome.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|