Automate hard disk copy/restore with Powercopy:

Scripting is supported only by Powercopy Professional PLUS or RESTORE

HINT: Search for @NEW@ to get the new features of Version 4

New values at V4:
   INTELLICOPY= 0x0|0x1|0x2 
   UC$=Text User image comment
   DRIVE= may be blank to select
   PWRMBRBC=0x2 always replace Bootcode no user dialog
   PARTLOC=0x8x locical or with 0x80 (0x80...0x85) to clear existing drive layout;
   PARTLOC=0x5  new value restore at start of disk and maximize (! ! ! ! NTFS only and newer NT4);
   PRESIZE=<0xHEXVALUE> to resize partition to a fixed size

Definition of the hard disk copy script file
Examples:
COPY Primary Partition -> Image: copy first partition to an image-file
COPY Logical Drive -> IMG: copy logical drive of an extended partition to an image-file
1:1 copy upto the end of a specified partition
Copy drive c: and d: at once
WASH: "wash" a logical drive
ERASE entire hard disk: Erases entire hard disk with no user interaction
ERASE MBR: Erase the master boot record
ERASE extended Partition: Erase the content of an extended partition
ERASE logical drive: Erase the content of a logical drive inside an extended partition
COPY/RESTORE PartitionImage -> HD: Copy an image of a partition to first partition on hard disk with compare
COPY/RESTORE Image -> HD use original location: Restore a full disk image or image of a partition to first hard disk at the original location!
COPY/RESTORE PartitionImage -> End of hard disk: Restore an image of a partition to the end of hard disk with compare and store the partition information to  the 4th primary partition location
SHIELD: Swaps/toggles/set/remove shield state of a hard disk

Basics:
To invoke script-support you have to specify argument /hdfunctions
Use Powercopy filename pc.exe (32bit-DOS version ) together with Powercopy BootCD/DOS/WIN95/WIN98/WINME 
Use Powercopy filename pc32.exe (32bit-Windows version ) together with WIN NT4 / XP /2000 ...

Parameters:  [] optional   <> required if option set
/hdfunctions [<scriptfile>] Any ascifile. Default name is PC_HDCPY.INI or Imagefilename.JOB
[/imgf <Imagefilename.000>]
[/imgs <Splitsize>] If an Imagefile reaches this splitsize the next imagename(Hexadezimal) will be created
Imagefilename.000 .001 .002 ... .00a .00b ... upto .FFF Default size is 2GB
[/imgc <CommentFile.txt>] This file may contain upto 80 bytes of comment stored in image-file

pc(32).exe /hdfunctions [<scriptfile>] [/imgf <Imagefilename.000>] [/imgs <Splitsize>]
e.g. pc.exe|pc32.exe /hdfunctions /imgf x:\my_Image.000

If you do not specify any values for Source- or Destination Drive you can select manually.


A T T E N T I O N !!!!!!!:
A) After every copy job the @HDCOPY.PC@ file will be deleted to avoid accidentially usage!
        Before starting Powercopy from a batch file you have to copy your template HDCOPY file to PC_HDCPY.INI!
        Example batch line: copy MyHDCOPY.ini PC_HDCPY.INI
B) Version lower V2.1Rk only! Replace PXI= by PE= in scriptfiles below!

Definition of the hard disk copy script file

;section
    [HDTASKFLAGS]
        INFO=     0x0|0x1
;                         Displays information for a specified [SOURCEHD]
        COPY=     0x0|0x1|0x2
;                         Copy Restore a drive depends on [SOURCEHD] [DESTHDx] settings
;                 0x2 Powercopy >= Version 2.1Rk
;                 0x1 PartitionMode copies specified partition only
;                 0x2 FullDiskMode copies from sector 0 until end of specified partition
;                     or limited to /MAXHDCPY <value> sectors
;                 In case of IMAGE to DISK copy Image decides copy mode
;                  you can specify 0x1 or 0x2


        BACKUP=   0x0|0x1
;                         Special DISKCOPY in Backup  Mode
        REVBACKUP=  0x0|0x1
;                         Special DISKCOPY in Restore Mode
        COMPARE=  0x0|0x1
;                         allowed to set together with COPY BACKUP RESTORE
        ERASE=    0x0|0x1|0x2|0x3|0x4|0x5|0x6
;                 0x2|0x3|0x4|0x5|0x6 requires Powercopy >= Version 2.1Rk
;                 0x1 Clear but ask user
;                 0x2 KILLMBRONLY; Erase sector 0
;                 0x3 FIRST20MB;
;                 0x4 ENTIREHD;
;                 0x5 PREPAREFORBACKUP;
;                 0x6 REMOVE one PARTition ENTRY inside MBR(Sector0);
;                     Partition MBR Index PI=1..4 can be cleared; PXI=is not supported,
;                     therefore a single logical drive entry cannot be removed.
;                     If PI refers to an extended Partition all logical drives will no more be
;                     visible.
;                 0x7 PARTITION CONTENT; CLEAR ENTIRE Content of a Partition

;      You may only specify one of  following commands

;      INFO, COPY, BACKUP, RESTORE, ERASE or SHIELD
;      Set COMPARE=0x1 if you want to compare drive after the the copy/backup/restore job

        SHIELD=   0x0|0x1
;                 0x0 disabled
;                 0x1 Swap/toggle drive protection for specified [SOURCEHD] DRIVE=0x8x
;                     hard disks only
;                     Partition Type 0xda is used to for shield drive
;                     off->on the file systems on this drive will not be visible to OS
;                     on->off the file systems on this drive will not be visible again to OS
;                 0x2 enable
;                 0x3 disable


;       NOUSERINPUT= 0x0|0x1
;                0x0 User has to confirm some critical dialogs*/
;                0x1 no user confirmation dialogs are displayed! Default values will be
;                     used instead!
        INTELLICOPY= 0x0|0x1|0x2 @NEW@ in Version4 Release d !
;                0x0 wash beforehand
;                0x1 normal copy
;                0x2 TURBO copy mode (clusterscan)
        UC$=Text @NEW@ in Version4 Release d !
;                Predefine a user comment (imagefiles)
;
;section
     [SOURCEHD] or
     [DESTHD1]
        DRIVE=0x80 0x81 0x82 0x83 0x84 0x85 0x86 0x87 0x90 0xA0 specify one ID only    
;                0x80 0x81 0x82 0x83 0x84 0x85 0x86 0x87 means Disk Drive 0..7 in DOS
;                0x80 means PhysicalDrive0 ... 0x87 means PhysicalDrive7 in
;                     WINDOWS NT/XP/2000x...
;                >= @NEW@ in Version4.01 at section [DESTHD1] If set to no drive "DRIVE=" or uncomment ';'
;                you will be asked for drive to restore.
;

;             Connection via LPT
;                 0x90 Connection via LPT
;
;             ImageFile
;                 0xA0 WriteRead To/From ImageFile
;
;                DOS Direct IDE Access via ATA commands !!!Currently not supported by Powercopy
;                    0x1 IDEPRIMMASTER
;                    0x2 IDEPRIMSLAVE
;                    0x3 IDESECONDARYMASTER
;                    0x4 IDESECONDARYSLAVE
;
;                DOS ASPII Access !!!Currently not supported by Powercopy
;                     0x1?  0x2?  0x3?  0x4?  0x5?
;                    1 2 3 4 5 indicates the host adapter; 
;                    ? indicates drive ID 0..F
;      
        PI=
0x0|0x1|0x2|0x3|0x4
;         Allowed Values for PI (PARTITION Index at MBR):
;        Supported by Versions >V2.1
;
;            0x0 use next free one
;            0x1 first 0x2 0x3 0x4 last Partition entry at mbr(sector 0)
;            if the index value is prefixed by C e.g. 0xC1 0xC2 0xC3 0xC4

;            the serialnumber of the partition/volume will be changed in case
;            of restoring a partition!
;
;
;       ATTENTION!! PI may only be set ONCE inside this configuration file!!!!
;
        PXI=0x0|0x1|0x2...
;        Allowed Values for PXI (PARTITION Extended Entry): 
;        *** Currently not Supported ****
;            0x0  Hole Primary or extended Partition
;            0x1  First logical drive inside extended Partition
;            0x2  ...
;       ATTENTION!! PXI may only be set ONCE inside this configuration file!!!!
;
        PACT= 0x0|0x1|0x2|0x3|0x4|0x77|0xFF
;         Allowed Values for PACT (Set the active PARTITION Flag at PI= value):
;         Supported by  >V2.1
;            0x0 or not set. Partitionentry inside Image will not be changed
;            0x1 MBR Partitionentry#1 will be set to active(start).
;            0x2 MBR Partitionentry#1 will be set to active(start).
;            0x3 MBR Partitionentry#1 will be set to active(start).
;            0x4 MBR Partitionentry#1 will be set to active(start).
;            0x77 MBR Partitionentry where the current partition is stored to, will be set inactive.
;            0xFF MBR Partitionentry where the current partition is stored to, will be set active.
;
;       ATTENTION!! PACT may only be set ONCE inside this configuration file!!!!
;
        PWRMBRBC= 0x0|0x1|0x2
;         Allowed Values for PWRMBRBC ([P]artition[WR]ite[M]aster[B]oot[R]ecord[B]oot[C]code):
;         Supported by  Versions >=V2.1
;
;            PWRMBRBC=0x2 @NEW@ in Version >=4.01 always replace no user dialog
;            PWRMBRBC=0x1 replace but ask. The boot code of the MBR inside an image will
;            be used replacing an existing one.
;            PWRMBRBC=0x0 The boot code of the MBR inside an image will **not** be used.
;            If there is no MBR boot code already set on disk the image will not boot.
;            Also pay attention, that the existing MBR boot code is a modern style one. Otherwise
;            active partitions bejond 4/8 GB will not boot into.
;
;       ATTENTION!! PWRMBRBC may only be set ONCE inside this configuration file!!!!
;
        PARTLOC= 0x0|0x1|0x2|0x3|0x4|0x5|0xXXXXXXXX   (Partition-Image -> HD mode only!)
;         Allowed Values for PARTLOCATION (Create [PART]ition at [LOCATION]):
;         Supported by  Versions >=V2.1
;
;            @NEW@ in Version 4.0 Release d !
;            If you logical OR PARTLOC value with hexadezimal 0x80
;            all existing partitions will be removed like restore on a blank new disk.
;            Example: PARTLOC=0x81 will clear all existing partition entries. Then the Partition
;            will be created at the beginning of free disk space.
;           
;           
PARTLOC=0x0  or not set. Ask User where to be located!
;            PARTLOC=0x1  Create Partition at the beginning of free disk space
;                            (First possible location)
;            PARTLOC=0x2  Create it at End of disk
;            PARTLOC=0x3  Create Partition at the beginning of the max free area
;            PARTLOC=0x4  Create Partition at original position; Powercopy >= Version 2.1Rk
;
;
            @NEW@ in Version 4.0 Release d !
;
           PARTLOC=0x5  restore at start of disk and maximize (! ! ! ! NTFS only and newer NT4);
;
;            PARTLOC=0xXXXXXXXX Values gt 10 means create Partition at next possible
;                               location at or after specified position.
;
;        ATTENTION!! PARTLOC may only be set ONCE inside this configuration file!!!!

        PRESIZE=<0xHEXVALUE) @NEW@ in Version4 Release d !
;            NTFS ONLY Partition extention.
;            Will be extended after running chkdsk /f <New-Driveletter>       

        PXCH=<0xHEXVALUE>
;         Exchange Partition entries
;         example 0x0401 exchanges MBR Partition entry 1 with Partition entry 4
;
;
;



examples:
This Example copies first partition(PI=1) of first found harddisk(0x80) to a Imagefile ([DESTHD1] DRIVE=0xa0) with compare

  Example HDCOPYCFGFILE PC_HDCPY.INI
    [] optional   <> required if option set
    pc(32).exe /hdfunctions [scriptfilename.ini] [/imgf <Imagefilename.000>]
    e.g. pc(32).exe /hdfunctions PC_HDCPY.INI /imgf x:\my_Image.000
;  PC_HDCPY.INI or PC_HDCPY.job file content
;  for example above
[HDTASKFLAGS]
  INFO=0x0
  COPY=0x1
  BACKUP=0x0
  RESTORE=0x0
  COMPARE=0x1
  ERASE=0x0
  NOUSERINPUT=0x0
  SHIELD=0x0

[SOURCEHD]
  DRIVE=0x80
  PI=1
  PXI=0

[DESTHD1]
  DRIVE=0xa0
 
;[DESTHD2] //Version Multi Clone only
;DRIVE=

;[DESTHD3] //Version Multi Clone only
;DRIVE=

;[DESTHD4] //Version Multi Clone only
;DRIVE=

Copy several partitions at once!

Example disk has one primary partition drive C: and one extended partition containing drive D: E: F:
C: starts at begin of disk
D: starts after C:
E: starts after D:
F: starts after E:
According to the Powercopy syntax 
C:  is  PI=1 PXI=0
D:  is  PI=2 PXI=1
E:  is  PI=2 PXI=2
F:  is  PI=2 PXI=3

To copy e.g. up to the end of the D: drive you have to set 1:1 copy mode by Copy=2 and setup to the end of D: by PI=2 and PXI=1

  Example HDCOPYCFGFILE PC_HDCPY.INI
    [] optional   <> required if option set
    pc(32).exe /hdfunctions [scriptfilename.ini] [/imgf <Imagefilename.000>]
    e.g. pc(32).exe /hdfunctions PC_HDCPY.INI /imgf x:\my_Image.000
;  PC_HDCPY.INI or PC_HDCPY.job file content
;  for example above
[HDTASKFLAGS]
  COPY=0x2

[SOURCEHD]
  DRIVE=0x80
  PI=2
  PXI=1

[DESTHD1]
  DRIVE=0xa0
This Example copies 3nd logical drive of an extended partition(PI=2 PXI=3) of second harddisk(0x81) to a Imagefile ([DESTHD1] DRIVE=0xa0)

;  PC_HDCPY.INI or PC_HDCPY.job file content
;  for example above
[HDTASKFLAGS]

  COPY=0x1
  COMPARE=0x0
  NOUSERINPUT=0x0

[SOURCEHD]
  DRIVE=0x81
  PI=2
; extended partition resides on second entry PI=2 inside MBR
  PXI=3
; third logical drive shal be hadled

[DESTHD1]
  DRIVE=0xa0

 
;[DESTHD2] //Version Multi Clone only
;DRIVE=

;[DESTHD3] //Version Multi Clone only
;DRIVE=

;[DESTHD4] //Version Multi Clone only
;DRIVE=
This example erases entire content on second hard disk(0x81) with no user interaction

  Example HDCOPYCFGFILE PC_HDCPY.INI
    [] optional   <> required if option set
    pc(32).exe /hdfunctions [scriptfilename.ini]
    e.g. pc(32).exe /hdfunctions PC_HDCPY.INI

;  PC_HDCPY.INI or PC_HDCPY.job file content
;  for example above
[HDTASKFLAGS]
  ERASE=0x1
  NOUSERINPUT=0x1

[SOURCEHD]
  DRIVE=0x81

EXAMPLE job file to ERASE the first sector of a disk( MBR):

Old Syntax:

This example erases the master boot record (first sector only /maxhdcpy 1) on second hard disk
  /maxhdcpy specifies the amount of sectors to handle

  Example HDCOPYCFGFILE PC_HDCPY.INI
    [] optional   <> required if option set
    pc(32).exe /hdfunctions [scriptfilename.ini] /maxhdcpy 1
    e.g. pc(32).exe /hdfunctions PC_HDCPY.INI /maxhdcpy 1

;  PC_HDCPY.INI or PC_HDCPY.job file content
;  for example above
[HDTASKFLAGS]
  ERASE=0x1
  NOUSERINPUT=0x1

[SOURCEHD]
  DRIVE=0x81

At Powercopy from V2.1 and above use this syntax:

ERASE=

;                 0x2|0x3|0x4|0x5|0x6 requires Powercopy >= Version 2.1Rk
;                 0x1 Clear but ask user
;                 0x2 KILLMBRONLY; Erase sector 0
;                 0x3 FIRST20MB;
;                 0x4 ENTIREHD;
;                 0x5 PREPAREFORBACKUP;
;                 0x6 REMOVE one PARTition ENTRY inside MBR(Sector0);
;                     Partition MBR Index PI=1..4 can be cleared; PXI=is not supported,
;                     therefore a single logical drive entry cannot be removed.
;                     If PI refers to an extended Partition all logical drives will no more be
;                     visible.
;                 0x7 PARTITION CONTENT; CLEAR ENTIRE Content of a Partition

  Example HDCOPYCFGFILE PC_HDCPY.INI
    [] optional   <> required if option set
    pc(32).exe /hdfunctions [scriptfilename.ini]
    e.g. pc(32).exe /hdfunctions PC_HDCPY.INI

;  PC_HDCPY.INI or PC_HDCPY.job file content
;  for example above
[HDTASKFLAGS]
  ERASE=0x2
  NOUSERINPUT=0x0
; set no user input to 1 after you tested your script


[SOURCEHD]
  DRIVE=0x81

This example erases the entire content of an extended partition(stored at second partition entry) on first hard disk(0x80)

  Example HDCOPYCFGFILE PC_HDCPY.INI
    [] optional   <> required if option set
    pc(32).exe /hdfunctions [scriptfilename.ini]
    e.g. pc(32).exe /hdfunctions PC_HDCPY.INI
;  PC_HDCPY.INI or PC_HDCPY.job file content
;  for example above
[HDTASKFLAGS]
  ERASE=0x1

[SOURCEHD]
  DRIVE=0x80
  PI=2
  PXI=0
This example erases the entire content of fourth(PXI=4) logical drive inside an extended partition(stored at second partition entry) on first hard disk(0x80)

  Example HDCOPYCFGFILE PC_HDCPY.INI
    [] optional   <> required if option set
    pc(32).exe /hdfunctions [scriptfilename.ini]
    e.g. pc(32).exe /hdfunctions PC_HDCPY.INI
;  PC_HDCPY.INI or PC_HDCPY.job file content
;  for example above
[HDTASKFLAGS]
  ERASE=0x1

[SOURCEHD]
  DRIVE=0x80
  PI=2
  PXI=4
This example copies an image( x:\D80P1IMG.000; [SOURCEHD] DRIVE=0xa0) of a partition to first partition(PI=1) on first hard disk(DRIVE=0x80) with compare and make partition active(PACT=1)

  Partition entry 1 must be free on this drive! Otherwise you have to clear this entry before

  Example HDCOPYCFGFILE PC_HDCPY.INI
    [] optional   <> required if option set
    pc(32).exe /hdfunctions [scriptfilename.ini]
    e.g. pc(32).exe /hdfunctions PC_HDCPY.INI /imgf x:\D80P1IMG.000
;  PC_HDCPY.INI or PC_HDCPY.job file content
;  for example above
[HDTASKFLAGS]
  COPY=0x1
  COMPARE=0x1


[SOURCEHD]
  DRIVE=0xa0

[DESTHD1]
  DRIVE=0x80
  PI=1
  PXI=0
  PACT=1
This example restores an full disk image
or image of a partition( x:\SOME_IMG.000; [SOURCEHD] DRIVE=0xa0) on first hard disk(DRIVE=0x80) to the original location(PARTLOC=0x4)!

PARTLOC=0x4
defines that the image is restored to the original position on disk.
This feature is possible, because a Powercopy image-file contains this information.

  Example HDCOPYCFGFILE PC_HDCPY.INI
    [] optional   <> required if option set
    pc(32).exe /hdfunctions [scriptfilename.ini]
    e.g. pc(32).exe /hdfunctions PC_HDCPY.INI /imgf x:\SOME_IMG.000
;  PC_HDCPY.INI or PC_HDCPY.job file content
;  for example above
[HDTASKFLAGS]
  COPY=0x1


[SOURCEHD]
  DRIVE=0xa0

[DESTHD1]
  DRIVE=0x80
  PARTLOC=4


This example restores an image( x:\D80P1IMG.000; [SOURCEHD] DRIVE=0xa0) of a partition to 4th primary partition location(PI=4) and to the end(PARTLOC=2) of second harddisk with compare(COMPARE=0x1)

  Partition entry 4 must be free on this drive! Otherwise you have to clear this entry before

  Example HDCOPYCFGFILE PC_HDCPY.INI
    [] optional   <> required if option set
    pc(32).exe /hdfunctions [scriptfilename.ini]
    e.g. pc(32).exe /hdfunctions PC_HDCPY.INI /imgf x:\D80P1IMG.000
;  PC_HDCPY.INI or PC_HDCPY.job file content
;  for example above
[HDTASKFLAGS]
  COPY=0x1
  COMPARE=0x1


[SOURCEHD]
  DRIVE=0xa0

[DESTHD1]
  DRIVE=0x81
  PI=4
  PXI=0
  PARTLOC=2
This example "washes" logical drive "E:\"

 
requires higher or equal Version 2.1Rk

  Example HDCOPYCFGFILE PC_HDCPY.INI
    [] optional   <> required if option set
    pc(32).exe /hdfunctions [scriptfilename.ini] /w <DriveLetterToWash>:\washdisk.000
   
IMPORTANT! Argument /W has to be specified A-F-T-E-R argument /hdfunctions !
You have to specify parameter /hdfunctions even if no     parameter was set inside PC_HDCPY.INI

    To ensure no file overwrite dialog appears you should add a delete command line before washing any disk in batch mode
    del E:\washdisk.*
    e.g. pc(32).exe /hdfunctions PC_HDCPY.INI /w E:\washdisk.000
;  PC_HDCPY.INI or PC_HDCPY.job file content
;  for example above
[HDTASKFLAGS]
       NOUSERINPUT= 0x0
; 0x0 User has to confirm some critical dialogs
; 0x1 no user confirmation dialogs are
;     displayed! Default values will be used
;     instead!
This example swaps/toggles/set/remove shield state of first harddisk(0x80)

Example HDCOPYCFGFILE PC_HDCPY.INI
    [] optional   <> required if option set
    pc(32).exe /hdfunctions [scriptfilename.ini]
    e.g. pc(32).exe /hdfunctions PC_HDCPY.INI
    Example ini files are available at bootcd search for '80off.ini'
Please note! The new unshield/shield status is recognized by an operating system AFTER you have rebooted your system.
;  PC_HDCPY.INI or PC_HDCPY.job file content
;  for example above
[HDTASKFLAGS]
 SHIELD=0x1
; 0x0 disabled
; 0x1 swap/toggle
; 0x2 enable shield
; 0x3 disable shield
 NOUSERINPUT=0x1


[SOURCEHD]

 DRIVE=0x81