Announcement

Collapse
No announcement yet.

help simplify batch script

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • help simplify batch script

    I am a novice at scripting. I have a script to run backup scripts from source to an internal and external destination. My script verifies that the source and destinations are correct. I would like to do this with Volume names and serial numbers, but I do not know how to do it, if possible. My solution is to have a specific verifying directory which I check for it's existance, then procede. I want screens to show me success or failure, specifically. I am mainly questioning my handling of the verification process, but any recommendations are appreciated. It seems that a more elequent way of verifying can be done.
    I want to check src and if ok, continue, if not, end process. Then check both destinations. Notify specifically if 1 or both fail and which. Also the same with successful backups. Can variables be used here?
    Backup specific area not part of this question. Thanks.
    Len

    Below is script:
    Moderator Edit: "added [code]-tags around the code" .\Rems
    Code:
    Rem ck src
    IF NOT EXIST "h:\DriveID-Data" goto :src-error                     
    goto :dest-both
    Rem ck dst
    :Dest-both
    IF NOT EXIST "I:\DriveID-Backup INT" goto :Dest-int
    IF NOT EXIST "I:\DriveID-Backup EXT" goto :dest-ext
    goto :Backup-both
    :Dest-int
    IF NOT EXIST "I:\DriveID-Backup INT" goto :dest-error-int 
    goto :backup-int
    :dest-ext
    IF NOT EXIST "I:\DriveID-Backup EXT" goto :dest-error-ext
    goto :Backup-ext
    
    :src-error
    src-error.vbs
    goto :end
    :dest-error-int
    dest-error-int.vbs
    goto dest-ext
    :dest-error-ext
    dest-error-ext.vbs
    goto :end
     
    Rem Backup
    :Backup-both
    robocopy "d:\a information\cpu" i:\Backup  /e /LOG:BackupLog-int.txt 
    robocopy "d:\a information\cpu" i:\Backup\ext /e /LOG:BackupLog-ext.txt        
    goto :ok-both
    :Backup-int
    robocopy "d:\a information\cpu" i:\Backup  /e /LOG:BackupLog-int.txt 
    goto :ok-int
    :backup-ext
    robocopy "d:\a information\cpu" i:\Backup\ext /e /LOG:BackupLog-ext.txt        
    goto :ok-ext
     
    Rem msgboxs
    :ok-both
    ok-both.vbs
    goto :end
    : ok-int
    OK-int.vbs
    goto :dest-ext
    : ok-ext
    ok-ext.vbs
    goto :end
    :End
    exit
    Last edited by Rems; 30th September 2008, 21:28.
Working...
X