| FBShellExt Download below. |
This shows how to set up registry entries that allow you to backup GDB/FDBs and restore GBK/FBKs by right-clicking them in the Explorer. It also registers IBServer.exe's icon for all four file types. Based on an idea by Markus Ostenried. | |
|
|
||
| requirements |
What you must have to be able to use FBShellExt: | |
| Registry access: | You must have access to the windows registry. | |
|
|
||
| how it works | Read these instructions before downloading / installing! | |
| The .reg file below sets up file associations
for .GDB / .FDB and .GBK / .FBK files in the Windows registry. Each of them
calls a batch file with the appropriate GBAK command line in it. I put these
batch files in the Firebird\bin directory, since gbak.exe must be in the search
path anyway - so the batches are found there as well.
When you backup, the backup file will be named BACKUP.GBK and the output of
gbak will go into BACKUP.TXT (which is deleted before each run as it must not
exist for gbak).
When you Restore, the restored database will be named RESTORED.GDB and the
gbak output goes to RESTORED.TXT (which is also delete before) |
||
| checking the results | I found some problems in using ERRORLEVEL to determine whether GBAK was succesful (it reported errorlevel 0 when the username doesn't exist), so I made the batch files simply TYPE the results file after GBAK finished. Looking at the output file is still the best way to see what went wrong and why... | |
| Win ME/XP warning | Note the .reg files below register
the ability to backup for .GDB and .FDB files, you can restore .GBK
and .FBK files. This is because M$ was so "kind" as to include
.GDB in the file <WINDOWS>\SYSTEM\RESTORE\FILELIST.XML, which
is not editable by the user (that is, you can edit whatever you like - as soon
as you save, all edits are discarded by the operating system).
This leads to Windows ME/XP copying (!) every .GDB file when the last user disconnects (causing the timestamp of the .gdb to change) when the System Recovery "feature" is enabled. {They might call it a feature, imho this is an obvious case of sabotage - or why else would they include the extension of a non-M$ database, but NOT include .MDB ??? Strange, isn't it?} |
|
| Security issues ! important ! |
To get around the usual discussion
regarding storage of passwords, I made it so that you *can* put the password
hard-coded into the batch file (which is NOT RECOMMENDED for real-life systems!,
but ok for your development machine where no one else has access to.)
As an alternative I tried to find a way to safely input the password from the
command line in a batch file (NOT showing what you type in clear text), but
I haven't yet figured out an easy way that would run on any Windows version.
If you know that trick, please let me know!
In the meantime I started a separate project (GBAK_GUI.exe) to circumvent this problem. More on that soon... |
|
|
|
||
| Download FBShellext.zip | (~ 2 kb) This zip includes the following files: | |
| gbak_backup.bat: This is the batch file
that is called when you choose "Backup" in the context menu of a
.GDB/.FDB file in the explorer. |
||
| gbak_restore.bat: This is the counterpart
to gbak_backup.bat, which is called when you choose "Restore" in
the context menu of a .GBK/.FBK file in the explorer. |
||
| FBShellext.reg: The registry file for (afaikt)
all Win versions except for Windows NT. GBAK and the two batch files above
must be in the search path in order for this to work. See below
for the contents of this file. |
||
| FBShellextnt.reg: This is the .reg file for
Windows NT. Appearently you have to specify the full path to GBAK and the batch
files here, so you will have to edit the .reg file and change the paths before
you can use this. Also you can't put the Shell command into the reg key with
the file extension, but have to create another key where the file extension
key must point to. See below for the contents of this
file. |
||
| Windows versions | I tested the above on Win2000 Pro, XP Pro, ME and NT 4 SP 5. Others are not tested, but should work ok - but note Windows NT, where you'll need the FBShellExtNT.reg file. If you find any problems / incompatibilites, please let me know. | |
|
|
||
| This is the .reg file for NT4: | ||
REGEDIT4 |
||
| ..and here
the one for (afaikt) all other Win versions: (note the newer Win versions don't have REGEDIT4 as a title, but they accept this as well) |
||
REGEDIT4 |
||