Menu

Batch file on usb drive

Help
2008-03-02
2012-11-19
  • Nobody/Anonymous

    Hello.  Ive sucessfully created a shortcut on desktop that opens keepass and backup database plugin works from my flash drive E.  I read in help files that if the keepass.exe and database and key are on usb drive (which mine are) I should use a batch file on the usb drive.  Couldnt find any documentation on how to do this.

    can you briefly explain how to create a batch file on the usb so when i click on my desktop shortcut it runs  correctly off of the usb?  Or will I have to start program from flash when using this on different computers? Like your help files indicated it would be a pain to reconfigure everytime I use a different computer with the same flash drive.

    Thanks for all your help.

    Aaron

     
    • Bill Rubin

      Bill Rubin - 2008-03-02

      You can use a shortcut on each computer so that you don't need to start KeePass from the USB flash drive.  Your batch file can look something like this:

      @echo off
      start /D"%~dp0" KeePass.exe database.kdb -keyfile:pwsafe.key %*

      This assumes that all the needed files (the batch file, KeePass.exe, etc.) are in the same folder on your USB flash drive.  (If that's not the case for you, adjust the above statement accordingly.)  The key point (no pun intended) is that /D"%~dp0" sets the current directory to be that folder before starting KeePass.  Your shortcut target should be the batch file instead of KeePass.exe. 

      The above configuration takes care of everything except the backup path.  (I assume you're backing up to the PC.)  You could add the command line option(s) for the backup path to the batch file, too -- so long as it's the same on each PC.  But if the backup path is different on different PCs (more likely), put the command line option(s) for the backup path in the shortcut target on each PC where you want backup.  That way, they'll be passed into the batch file, and appended to the KeePass.exe command line by the "%*" variable.

      Bill Rubin

       
    • Nobody/Anonymous

      Thank you.

       

Log in to post a comment.

MongoDB Logo MongoDB