Customise "Backup Drive with TeraByte Image for Windows"

User discussion and information resource forum for Image products.
Post Reply
Mikka
Posts: 12
Joined: Sun Aug 21, 2016 10:37 am

Customise "Backup Drive with TeraByte Image for Windows"

Post by Mikka »

Hi,

IfW offers the option to create a partition image with a single click, using a preset compression level and image file name.
The name pattern is stored in the Registry in the key
[HKCR\Drive\shell\Backup Drive with TeraByte Image for Windows\command]
and points to the file contextbackup.cmd. The relevant part of the registry value reads:
Drive $DL$ - $~YYYY$-$~MM$-$~DD$ @ $~HHMM$
That means, a .tbi named Drive C - 2016-08-21 @ 1240 will be created.

I'm looking for this: C system @Computer001 - 2016-08-21 @ 1240
i.e. {Drive letter} {Partition label*} @{Computer name} - {Date @ Time}

How can this be done?
Best regards.
__
* if existing
TeraByte Support
Posts: 3598
Joined: Thu May 05, 2011 10:37 pm

Re: Customise "Backup Drive with TeraByte Image for Windows"

Post by TeraByte Support »

So %DL% is handle by the batch file. You could use tbscript to do
everything or could use tbosdt to help batch file. Say your volume label is
what you want ..

echo list vol %Drive%: > %temp%\getvollab.run
"C:\Program Files (x86)\TeraByte Drive Image Backup and Restore
Suite\TeraByte OSD Tool Suite Pro\win\tbosdtw" %temp%\getvollabl.run >
%temp%\myvollab.txt
set /P thevollab=<%temp%\myvollabl.txt

.... Now your %thevollab% has the volume label.

hostname > %temp%\hostname.txt
set /P myhost=<%temp%\hostname.txt

now %myhost% has the machine name.

"Mikka" wrote in message news:12229@public.image...

Hi,

IfW offers the option to create a partition image with a single click, using
a preset compression level and image file name.
The name pattern is stored in the Registry in the key
[HKCR\Drive\shell\Backup Drive with TeraByte Image for Windows\command]
and points to the file contextbackup.cmd. The relevant part of the registry
value reads:
Drive $DL$ - $~YYYY$-$~MM$-$~DD$ @ $~HHMM$
That means, a .tbi named Drive C - 2016-08-21 @ 1240 will be created.

I'm looking for this: C system @Computer001 - 2016-08-21 @ 1240
i.e. {Drive letter} {Partition label*} @{Computer name} - {Date @ Time}

How can this be done?
Best regards.
__
* if existing
Mikka
Posts: 12
Joined: Sun Aug 21, 2016 10:37 am

Re: Customise "Backup Drive with TeraByte Image for Windows"

Post by Mikka »

I have not used tbscript yet, but did find a solution for both {Partition label} and {Computer name} in pure batch:

:: Computer name
For /f "tokens=2 delims='='" %%? In ('wmic OS Get CSName /value') Do (Set Hostname=%%?)

:: Volume/partition label, ensuring that whitespace within the label is replaced and the leading character is one blank
For /f "usebackq tokens=2 delims==" %%# In (`wmic LogicalDisk where "DeviceID='%Drive%:'" Get VolumeName /format:value`) Do (Set DriveLabel=%%#)
If Defined DriveLabel (
Set DriveLabel=%DriveLabel: =_%
Set DriveLabel= %DriveLabel%
)

I'm not supposed to tamper with :RunIFW, right?

What is your suggestion to get the two additional parameters in the file naming scheme?
Shall I extend the IFWParms variable?
Or is it necessary to alter the value under [HKCR\Drive\shell\Backup Drive with TeraByte Image for Windows\command]?
TeraByte Support
Posts: 3598
Joined: Thu May 05, 2011 10:37 pm

Re: Customise "Backup Drive with TeraByte Image for Windows"

Post by TeraByte Support »

see the prior post which showed you how to do it and put them in variables,
then just use those variables when building the file name in the .cmd file
(as it does now, just add your new ones).


"Mikka" wrote in message news:12322@public.image...

I have not used tbscript yet, but did find a solution for both {Partition
label} and {Computer name} in pure batch:

:: Computer name
For /f "tokens=2 delims='='" %%? In ('wmic OS Get CSName /value') Do (Set
Hostname=%%?)

:: Volume/partition label, ensuring that whitespace within the label is
replaced and the leading character is one blank
For /f "usebackq tokens=2 delims==" %%# In (`wmic LogicalDisk where
"DeviceID='%Drive%:'" Get VolumeName /format:value`) Do (Set DriveLabel=%%#)
If Defined DriveLabel (
Set DriveLabel=%DriveLabel: =_%
Set DriveLabel= %DriveLabel%
)

I'm not supposed to tamper with :RunIFW, right?

What is your suggestion to get the two additional parameters in the file
naming scheme?
Shall I extend the IFWParms variable?
Or is it necessary to alter the value under [HKCR\Drive\shell\Backup Drive
with TeraByte Image for Windows\command]?

Mikka
Posts: 12
Joined: Sun Aug 21, 2016 10:37 am

Re: Customise "Backup Drive with TeraByte Image for Windows"

Post by Mikka »

I got the two variables already and they work like a charm.

It's passing them on what doesn't work yet. And I'm wondering where I've got to make changes:
1) Registry value (command)
2) Parameter logic of contextbackup.cmd itself (e.g. for Set IFWParms)
3) Both of them

The relevant line of contextbackup.cmd is
start "" %IFWPath% /b /d:?%Drive% %IFWParms%
and it's just the drive letter which is accepted as parameter.

The Registry value holds the timestamp part, the file naming happens there.
So instead of ..\Drive $DL$ - $~YYYY$-$~MM$-$~DD$ @ $~HHMM$" %1 it should be like
..\$DL$ %DriveLabel% @%Hostname% - $~YYYY$-$~MM$-$~DD$ @ $~HHMM$" %1
but both new variables need to be made public via handles, is that correct?

For the time being, I'd like to do without tbscript if possible.
TeraByte Support
Posts: 3598
Joined: Thu May 05, 2011 10:37 pm

Re: Customise "Backup Drive with TeraByte Image for Windows"

Post by TeraByte Support »

The information given before was not TBScript, it was a batch file.

Right, if you change it to include say $MYCUSTOM$ then in the batch file
after it changes the $DL% to the %drive%

You could do the same:
set IFWParams=~IFWParams:$MYCUSTOM$=%drivelabel%@%hostname%-~


You just add the variable to the filename.

start "" %IFWPath% /b /d:?%Drive% %IFWParms%

"Mikka" wrote in message news:12353@public.image...

I got the two variables already and they work like a charm.

It's passing them on what doesn't work yet. And I'm wondering where I've got
to make changes:
1) Registry value (command)
2) Parameter logic of contextbackup.cmd itself (e.g. for Set IFWParms)
3) Both of them

The relevant line of contextbackup.cmd is
start "" %IFWPath% /b /d:?%Drive% %IFWParms%
and it's just the drive letter which is accepted as parameter.

The Registry value holds the timestamp part, the file naming happens there.
So instead of ..\Drive $DL$ - $~YYYY$-$~MM$-$~DD$ @ $~HHMM$" %1 it should be
like
...\$DL$ %DriveLabel% @%Hostname% - $~YYYY$-$~MM$-$~DD$ @ $~HHMM$" %1
but both new variables need to be made public via handles, is that correct?

For the time being, I'd like to do without tbscript if possible.

Mikka
Posts: 12
Joined: Sun Aug 21, 2016 10:37 am

Re: Customise "Backup Drive with TeraByte Image for Windows"

Post by Mikka »

First off, it's functional now, thanks alot! :D
That comes in quite handy as now I can make full use of the context menu option.

A last detail concerns the timestamp pattern $~YYYY$-$~MM$-$~DD$ @ $~HHMM$
It will output the current time as 2016-08-28 @ 1502 - which is correct - however
2016-08-28 @ 15.02
would be better.

$~HH gives me the two digit hour number. $~MM gives me the two digit month number,
what are the minutes (incl. leading zero)?

Thank you very much for your support!
TAC109
Posts: 273
Joined: Tue Sep 06, 2011 10:41 pm

Re: Customise "Backup Drive with TeraByte Image for Windows"

Post by TAC109 »

Introducing an extra dot into the image file name is not a good idea. I've had problems with this in the past with issues such as mis-named hash files, and restores not automatically being able to follow the chain of image files back to the linked Incrementals and Full backups.
Mikka
Posts: 12
Joined: Sun Aug 21, 2016 10:37 am

Re: Customise "Backup Drive with TeraByte Image for Windows"

Post by Mikka »

Hm. Okay, I'll keep it for the moment. However, a delimiter could improve readability:
Maybe a comma or an apostrophe would be better?
Mikka
Posts: 12
Joined: Sun Aug 21, 2016 10:37 am

Re: Customise "Backup Drive with TeraByte Image for Windows"

Post by Mikka »

Any idea how I can structure $~HHMM$ with an apostrophe as in: 15'02 ?
Post Reply