Create a Script Manually

Top  Previous  Next

R-Drive Image has a very powerful and versatile script language that enables you to create scripts for all your needs.

A script consists of commands and their parameters. All commands, parameter, and their values are case-sensitive.

Incompatibilities with ver.3.x

 

Ver. 3.x

Ver. 4.x

File names with "

Escaping of the " character has been changed

""

"

File names with &

Escaping of the & character has been changed

&

&

Partition list

Several partitions should be set in one list

-s="part1" -s="part2" -s="part3"

-s="part1 part2 part3"

General:

The default extension for R-Drive Image script files is .rdi.

Parameter values may be inclosed in single (') or double (") quotes. if the value does not contain spaces, the quotes may be omitted.

R-Drive Image ignores spaces in the beginning of a line. R-Drive Image treats multiple spaces as one space, except when they are in a parameter value enclosed in quotes.

Examples:

Below are equal lines:

create -a = "c:\archive.arc"

   create   -a = "c:\archive.arc"

Below are not equal lines:

create -a = "c:\archive 1.arc"

create -a = "c:\archive    1.arc"

Comments:

R-Drive Image treats lines which the first non-space character is ; or the first non-space character is [ and the last one is ], as comments.

Examples:

; This is a comment line

[This is a comment line]

Multiple lines:

If the last non-space character in a line is \, R-Drive Image appends the next line to it:

Example:

Lines:

create -a = "c:\archive.arc" -s = "1:1" \

c = "5"

are equal to the line:

create -a = "c:\archive.arc" -s="1:1" c=  "5"

Disk size units

Values specifying disk sizes my be in units.

b

bytes

 

Kb

kilobytes

2^10 = 1,024 b

Mb

megabytes

2^20 = 1,024 Kb

Gb

gigabytes

2^30 = 1,024 Mb

If the units are used, enclose the value in quotes.

Default values are Mb (megabytes).

Characters to substitute

If the following characters are to appear in the parameter values, they should be substituted by the following rules:

Character

String to substitute

"

"

'

'

&

&

carriage return

&cr;

new line

&nl;

Note: This is the incompatibility with scripts created for  the earlier versions of R-Drive Image.

Script commands and parameters:

Command

Its Parameters

Optional/

Mandatory

Description and examples

create

Mandatory

Creates an image file. If such file already exists, R-Drive Image will ask whether the file should be overwritten. If the a switch is used, R-Drive Image will not overwrite the file.

append

Mandatory

Incrementally appends data to an existing image file. If such file does not exist, it will be created.

-s=<ImageSource>

Mandatory

Specifies an image source. Examples:

for hard drive 1: -s=1

for the second partition on hard drive 1: -s=1:2

for a logical disk: -s=D:

for several logical disks: -s="D: F:"

-a=<PathOfNewArchiveFile>

Mandatory

Specifies a path (including its file name) to the image file.

Examples:

-a=C:\Images\Test.arc or -a="C:\Image Files\Test 1.arc"

-c=<CompressionLevel>

Optional

Specifies compression level (1...11).

Example: -c=3

-u

Optional

Backups useful information only. May be used as a Boolean parameter.

-v=<ArchiveSize>

Optional

Specifies image split size. May be in the float-point format.

Example: -v=650 or -v='4.5 Gb'

-p=<Password>

Optional/

Mandatory

Specifies an image password. Mandatory if the append command is used and the image file has been already encrypted. It there is a space in the password, the password should be in quotes.

Examples: -p=Password or -p='My Password'

-r=<Description of archive>

Optional

Specifies an image description. It there is a space in the description, the description should be in quotes.

Examples: -r=Description or -r="Image Description"

-s-xw

Optional

Makes R-Drive Image not to use the Windows snapshot provider.

-s-xr

Optional

Makes R-Drive Image not to use the R-TT snapshot provider.

-s-n

Optional

Notifies system application that a snapshot is being taken.

-s-b0=<AppBeforeBack>

Optional

Specifies an application that will start before the backup operation starts. The application should return a 0 exit code.

Example: -s-b0="C:\commands\start.exe"

-s-b1=<AppAfterBack>

Optional

Specifies an application that will start after the backup operation completes. The application should return a 0 exit code.

Example: -s-b1="C:\commands\end.exe"

-s-s0=<AppBeforeSnapShot>

Optional

Specifies an application that will start before the snapshot is taken. The application should return a 0 exit code.

Example: -s-s0="C:\commands\startsnapshot.exe"

-s-s1=<AppAfterSnapShot>

Optional

Specifies an application that will start after the snapshot is taken. The application should return a 0 exit code.

Example: -s-s1="C:\commands\endsnapshot.exe"

-xe=<AppIfError>

Optional

Specifies a command line that will start an application if R-Drive Image fails to perform the specified action. If there is a space in the command line, the command line should be in quotes.

Examples: -xe=error.exe or -xe="winamp C:\sounds\error.mp3"

-xs=<AppIfSucc>

Optional

Specifies a command line that will start an application if R-Drive Image successfully performs the specified action. If there is a space in the command line, the command line should be in quotes.

Examples: -xs=success.exe or -xs="winamp C:\sounds\success.mp3"

Example:

create -s="F: H:" -a="I:\Test Image.arc" -c=3 -u = true -p="My Password" -r="This is a test image" -xe="winamp C:\sounds\error.mp3" -xs="winamp C:\sounds\success.mp3"

This script creates an image of logical disks F: and H:. The path and filename for this script is I:\csys.arc, with compression level 3, and only useful information on this disk will be written to the image. This image is protected with the password "My Password", and its description is "This is a test image". If the script action has been performed successfully, the winamp application will play the success.mp3 file, and if an error occurs, it will play the error.mp3 file.

restore

Mandatory

Restores data from an image to a specified disk place

-s=<ImageSource>

Mandatory

Specifies an image source. Examples:

for hard drive 1: -s=1

for the second partition on hard drive 1: -s=1:2

for a logical disk: -s=D:

for several logical disks: -s="D: F:"

-d=<ImageDestination>

Mandatory

Specifies a destination disk:partition on which the data is to be restored. Examples:

for hard drive 1: -d=1

for the second partition on hard drive 1: -d=1:2

for a logical disk: -d=D:

-a=<PathOfArchiveFile>

Mandatory

Specifies a path (including its file name) to the image file from which data is to be restored. It there is a space in the path, the path should be in quotes.

Examples: -a=C:\Images\Test.arc or -a="C:\Image Files\Test.arc"

-k=<"PartitionStatus">

Optional

Specifies a status (primary/active) for a partition to be restored.

Settings:

+p is a primary partition -p is a secondary partition

+a is an active partition -a is a non-active partition

Please note that the combination "-p +a" is invalid. If this parameter is not specified, the data from the image will be used.

Examples:

-k="+p+a" the partition will be primary and active.

-k="+p" the partition will be primary. Information in the image will be used to make the partition either active or non-active.

-t=<TimeSliceNumber>

Optional

Specifies which incremental data will be used to restore the data from the image. If the TimeSliceNumber is not specified or specified, the first data in the image will be used. -1 specifies the last incremental data in the image.

Examples: -t="2" specifies the second incremental data in the image will be used to restore data.

-lr=<DiskLetter>

Optional

Specifies a disk letter. This parameter is case-insensitive.

Examples: -lr="k" or lr=k.

-sz="<PartitionSize>

Optional

Specifies a partition size. May be in the float-point format.

Example: -sz=512 or -sz='0.5 Gb'

-of="<PartitionOfset>

Optional

Specifies an offset from the beginning of the destination. May be in the float-point format. Default is 0.

Example: -of=512 or -of='0.5 Gb'

mail options

Optional

Sends e-mail messages if the action fails or succeeds and specifies e-mail parameters. If a personal firewall is installed on your computer, you should allow the r-driveimagecl.exe application to get access to the e-mail server.

-me

Optional

Sends an e-mail message when R-Drive Image fails to perform the specified action. May be used as a Boolean parameter.

-mx

Optional

Sends an e-mail message when R-Drive Image successfully performs the specified action. May be used as a Boolean parameter.

-ms=<SMTPServer[:port]>

Mandatory/Not used

Mandatory if the -me or/and -mx option is used. Specifies an SMTP server and port (optional).

Examples: -ms=mail.example.com or -ms=mail.example.com:25

-ma=<SenderEmail>

Mandatory/Not used

Mandatory if the -me or/and -mx option is used. Specifies a sender's e-mail address.

Example: -ma=rtt1@example.com

-mr=<RecepientEmail>

Mandatory/Not used

Mandatory if the -me or/and -mx option is used. Specifies a recipient's e-mail address or addresses.

Example: -ma=rtt2@example.com

-ml=<Login:Password>

Optional

Specifies a login and password at the SMTP server.

Example: -ml=rtt1:password

mail

Optional

Specifies all mail options globally for the entire script

Example:

mail -ms=mail.example.com -ma=rtt1@example.com -mr=rtt2@example.com -ml=rtt1:password -me -mx

This script sends e-mails confirming success or error of the action from rtt1@example.com to rtt2@example.com via the mail.example.com SMTP server using the default (25) port with the rtt1 login and password password.

list

Optional

Returns a partition list for a local disk

list -a="archive_name" 

[-t="time_slice" -p="password"]

Optional

Returns a partition list for an image file

Boolean parameters

Those are parameters that may have Boolean values:

true, 1, yes, false, 0, no.

They may be used as keys (example: -u) or as parameters with values (example: -u=true).

Entities or Variables.

Entities may be used as variables to create various text strings. They are start with & and end with ;.

Version Entities.

In the examples below, the R-Drive Image version is assumed as 4.1.67

Entity

Description

&rdi.ver;

The R-Drive Image version. Example: "4.1"

&rdi.ver.build;

The R-Drive Image build. Example: "4167"

&rdi.ver.major;

The R-Drive Image major version. Example: "4"

&rdi.ver.minor;

The R-Drive Image minor version. Example: "1"

&rdi.ver.subminor;

The R-Drive Image sub-minor version. Example: "67"

Result Entities

Entity

Description

&rdi.last_result;

Returns the last result of  R-Drive Image operation. May be undefined, success, failed.

Time Entities.

In the examples below, the system time is assumed as 11:10:04 AM

Entity

Description

&sys.time;

System time in the locale format. Example: "11:10:04". Please note that it is impossible to use this entity in file names because it contains an invalid character :.

&sys.time.m;

Minutes

&sys.time.h;

Hours in the 24 h format

&sys.time.h12;

Hours in the 12 h format

&sys.time.h24;

Hours in the 24 h format

&sys.time.s;

Seconds

&sys.time._m;

PM or AM

Date Entities.

In the examples below, the system date is assumed as February 1, 2007, Thursday

Entity

Description

&sys.date;

System date in the locale format. Example: "29/01/07". Please note that it is not recommended to use this entity in file names because that will create a chunk of folders.

&sys.date.d;

Month day. Example: "01"

&sys.date.m;

Month. Example: "02"

&sys.date.y;

Short year. Example: "07"

&sys.date.yyyy;

Long year. Example: "2007"

&sys.date.m.name;

Month name. Example: "February"

&sys.date.m.nm;

Short month name. Example: "Feb"

&sys.date.wd;

Week day number, starting from Sunday. Example: "5"

&sys.date.wd.name;

Week day name. Example: "Thursday"

&sys.date.wd.nm;

Short week day name. Example: "Th"

Enumeration Entities

Entity

Description

&rdi.enum;

Defines the number of calls to this entity. Starts from 0.

&rdi.enum.<Num>;

Defines the number of calls to this entity. Starts from 0. Num specifies the format of the number. Example: &rdi.enum.3; will return 001 for the second calls to this entity.

User-defined entities

You may create your own entities using the set command. Example:

set creat_date = "&sys.date.m.name;-&sys.date.d;-&sys.date.y;"

You may use this entity, for instance, set a command creating files with their date of creation as the file name:

create -a="D:\archive\&creat_date;.arc" -s="c:"

If the date when the script has been run is February 1, 2007, Thursday, this command will create an image of the logical disk C: and write it to the D:\archive\February-01-07.arc file.

Please note that the set command defines the entities rather than specifies their value. The actual value of an entity will be determined each time the entity is used. Example:

set creat_time = "&rdi.time.h24;-&rdi.time.m;-&rdi.time.s;"

and the creat_time entity is used in two commands in a script:

create -a="D:\archive\&creat_time;.arc" -s="c:"

create -a="D:\archive\&creat_time;.arc" -s="c:"

R-Drive Image will create two different files with different file names, each representing the time of file creation.

The unset command deletes entities. Example:

unset creat_date creat_time

After this command the creat_date and creat_time entities cannot be used and cause R-Drive Image to generate an error if they appear further in the script.

 

The Disk Actions chapter explains basic disk actions.

The Advanced Disk Actions chapter explains how to perform advanced disk actions.

The Technical Information chapter gives technical information on Supported CD and DVD Recorders and List of Supported Hardware Devices

Follow this link to obtain R-Drive Image Contact Information and Technical Support