FBShellExt
Download below.
back to top 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
back to top What you must have to be able to use FBShellExt:
Registry access: You must have access to the windows registry.

how it works back to top 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 back to top 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 back to top 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 !
back to top 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 back to top (~ 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 back to top 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

[HKEY_CLASSES_ROOT\.gdb]
@="InterBase Database"

[HKEY_CLASSES_ROOT\InterBase Database\DefaultIcon]
@="C:\program files\Firebird\bin\IBServer.exe"

[HKEY_CLASSES_ROOT\InterBase Database\Shell\Backup\Command]
@="C:\program files\Firebird\bin\gbak_backup.bat\"%1\""

[HKEY_CLASSES_ROOT\.gbk]
@="InterBase Backup"

[HKEY_CLASSES_ROOT\InterBase Backup\DefaultIcon]
@="C:\program files\Firebird\bin\IBServer.exe"

[HKEY_CLASSES_ROOT\.gbk\Shell\Restore\Command] @="C:\program files\Firebird\bin\gbak_restore.bat\"%1\""

[HKEY_CLASSES_ROOT\.fdb]
@="Firebird Database"

[HKEY_CLASSES_ROOT\Firebird Database\DefaultIcon]
@="C:\program files\Firebird\bin\IBServer.exe"

[HKEY_CLASSES_ROOT\Firebird Database\Shell\Backup\Command]
@="C:\program files\Firebird\bin\gbak_backup.bat\"%1\""

[HKEY_CLASSES_ROOT\.fbk]
@="Firebird Backup"

[HKEY_CLASSES_ROOT\Firebird Backup\DefaultIcon]
@="C:\program files\Firebird\bin\IBServer.exe"

[HKEY_CLASSES_ROOT\Firebird Backup\Shell\Restore\Command]
@="C:\program files\Firebird\bin\gbak_restore.bat\"%1\""

..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

[HKEY_CLASSES_ROOT\.gdb]
@="InterBase Database"

[HKEY_CLASSES_ROOT\.gdb\DefaultIcon]
@="IBServer.exe"

[HKEY_CLASSES_ROOT\.gdb\Shell\Backup\Command]
@="gbak_backup.bat\"%1\""

[HKEY_CLASSES_ROOT\.gbk]
@="InterBase Backup"

[HKEY_CLASSES_ROOT\.gbk\DefaultIcon]
@="IBServer.exe"

[HKEY_CLASSES_ROOT\.gbk\Shell\Restore\Command] @="gbak_restore.bat \"%1\""

[HKEY_CLASSES_ROOT\.fdb]
@="Firebird Database"

[HKEY_CLASSES_ROOT\.fdb\DefaultIcon]
@="IBServer.exe"

[HKEY_CLASSES_ROOT\.fdb\Shell\Backup\Command] @="gbak_backup.bat \"%1\""

[HKEY_CLASSES_ROOT\.fbk]
@="Firebird Backup"

[HKEY_CLASSES_ROOT\.fbk\DefaultIcon]
@="IBServer.exe"

[HKEY_CLASSES_ROOT\.fbk\Shell\Restore\Command] @="gbak_restore.bat \"%1\""