truecrypt automatically patch to start keepass

  • IchHier

    IchHier - 2012-11-23


    I logged in today and try me here with the translation tool from Google.

    I have a Truecrypt file that I always open after the KeePass file would have mounted.

    It should therefore be included automatically.

    How do I do that?

    Have been under Auto-Type the login window of Truecrypt favorites involved, but I must still press Ctrl + V, so it will be mounted.

    Thanks for the help.

    Last edit: IchHier 2012-11-23
  • Paul

    Paul - 2012-11-23

    You can use a trigger in KeePass. This will automatically run and mount TrueCrypt.
    Set the trigger to run after database opened.
    Action: run a command and use placeholders for the password.

    cheers, Paul

  • IchHier

    IchHier - 2012-11-24

    Thanks for the reply.

    However, I still have not quite understood how this works, since I am no programmer.

    The truecrypt file is automatically started by truecrypt.

    Here is a photo of truecrypt.

    I could choose this open window of truecrypt under Auto-Type easy.
    How do I do that in the trigger?

    Thank you for your trouble.

    Last edit: IchHier 2012-11-24
  • Paul

    Paul - 2012-11-24

    Use the command line option to mount the volume. Use a trigger to run a command like this.
    truecrypt /v c:\ /lF /p {PASSWORD}

    cheers, Paul

  • IchHier

    IchHier - 2012-11-24



    thanks for the reply.

    Have it now as you wrote + Password inserted.

    However, he does not find the drive.

    I have searched the internet and I created a mount.bat.
    "C:\Program Files\TrueCrypt\TrueCrypt.exe" /v \?\Volume{cc4cb81a-0936-11e2-b472-005XXXXXXXXX}\ /lF /a /s /quit

    But unfortunately it still does not work yet :-(

  • steelej

    steelej - 2012-11-24

    Have you created a Trigger as Paul suggested - see help files - that will run when KeePass has started. This should be configured to run TrueCrypt. A batch file is not required and will make your password exist in clear text in the batch file on your computer. This is not a good thing to do.

    Have you replaced "C:\" in Paul's example with the full file path to your own Truecrypt volume file?
    This seems to be C:\Users....\Unterlagen

    (this may or may not need a .tc at the end depending on the exact filename you have chosen)

    Have you replaced {password} in Paul's example with your own password or a reference to a Keepass record containing the password?

  • IchHier

    IchHier - 2012-11-25


    I created a trigger like paul said, at least I think;-)

    I also changed the path "C: \" changed

    However, I always get this error message

    I tried .. ... or ... Unterlagen ... tc without..

    The batch file I deleted

  • Paul

    Paul - 2012-11-25

    You need to change the truecrypt to "C:\Program Files\TrueCrypt\TrueCrypt.exe"

    cheers, Paul

  • Dominik Reichl

    Dominik Reichl - 2012-11-25

    Furthermore, the 'File/URL' field must only contain the application path, not the arguments; the arguments must be provided using the 'Arguments' field. So, in 'File/URL' enter 'C:\Program Files\TrueCrypt\TrueCrypt.exe', and put the rest into the 'Arguments' field.

    Moreover, it appears that there are spaces around the backslash characters in the database path. I doubt all your folders are wrapped in spaces, thus remove them.

  • IchHier

    IchHier - 2012-11-25


    many THANKS for the help.

    Now start TrueCrypt and the "Unterlagen" is displayed.

    However, it is not integrated mount

    Last edit: IchHier 2012-11-25
  • steelej

    steelej - 2012-11-25

    What do you have in the arguments field in the trigger.

    Have you entered the real password in the argument. - be careful though that you do not publish your real password in this forum. Replace the{password} in Paul's example with your password - no curly brackets.

    Note I would like this to be a reference to a password in a KeePass record as it would then be encrypted but I have not found a way of doing this within a trigger. Is this possible?

  • IchHier

    IchHier - 2012-11-26

    truecrypt /v C:\Users\XXXXXX\Unterlagen /lF /p {passwort}

    I {password} is replaced with the real password.

    I've yet understood, it is written with {.....}.

    truecrypt starts yes, only I have to go to embed, so open the password window

    Last edit: IchHier 2012-11-26
  • Paul

    Paul - 2012-11-26

    IchHier, try opening Truecrypt from the command line, then put the details in KeePass.

    steelej, to add a place holder in a trigger you need to tell KeePass where to obtain the item, so a reference is required. e.g. {REF:P@I:A2082E4A7F815445ADD88AA25ACB05F1}

    cheers, Paul

  • Dominik Reichl

    Dominik Reichl - 2012-11-26

    IchHier, remove the "truecrypt" from the beginning of the arguments line. Furthermore, I don't know what the "/lF" is supposed to to; it's not documented on Maybe you meant "/l F" (with a space), which would specify that the volume should be mounted to drive letter F.

  • Dominik Reichl

    Dominik Reichl - 2012-11-26

    steelej, field references are documented on

    • steelej

      steelej - 2012-11-26

      I have been using references successfully for nearly a year. I have however never fully succeed in getting them to work correctly within triggers.

      I have created a TrueCrypt database and have created a button via a trigger to test the process. The button runs the trigger to open the TrueCrypt database. Obviously this would be changed to Database Open when it works.

      I have created a KeePass record with the TrueCrypt file path in the URL field and the password in the Password field

      The problems I experienced were

      I cannot open a TrueCrypt volume by reference if there is a space in the path. Truecrypt reports an error with a trailing quotation mark shown in the filepath. In the KeePass record it is wrapped in quotation marks. I had to rename the filepath to one with no spaces and remove the quotation marks and then it brings up the TrueCrypt window showing the correct path from the reference and it will then open.

      I have however been unable to get TrueCrypt to accept the Password arguments. I have tried simply adding the /p <password> parameter following the /v <filepath> but it has always been ignored. I have not yet done sufficient testing to know whether this is a TrueCrypt or KeePass problem. Perhaps there is some parameter missing

      This is the argument string I am using to Truecrypt - this is a test file and contains no data.
      /v {REF:A@I:629383C0A4AF654491CB401E254974A5} /p test

      It does not open the TrueCrypt volume.

      The problem occurs with a simple password string as shown. I would like it to work with a reference however.

  • steelej

    steelej - 2012-11-26

    I have solved it - it is a TrueCrypt issue

    the Trigger arguments fields is (all on one line of course)
    /v {REF:A@I:629383C0A4AF654491CB401E254974A5} /lt /a /p "{REF:P@I:629383C0A4AF654491CB401E254974A5}"

    Replace the reference 629383C0A4AF654491CB401E254974A with your own reference

    The arguments are as follows
    /v will mount the file contained in the URL field in the reference
    /lt will mount the volume as the "t" drive
    /a mounts automatically (this is what I was missing)
    /p uses the reference to get the password field from the reference

  • IchHier

    IchHier - 2012-11-27


    now I've got it right, I forgot password specified {before and after} password.

    Now deOrdner starts automatically.


    A little thing I have, how do I minimize the window of TrueCrypt automatically in the taskbar after it was involved?

    Last edit: IchHier 2012-11-27
  • Paul

    Paul - 2012-11-27

    Try /q.

    /q /v {REF:A@I:629383C0A4AF654491CB401E254974A5} /lt /a /p "{REF:P@I:629383C0A4AF654491CB401E254974A5}"

    cheers, Paul

  • IchHier

    IchHier - 2012-11-27

    Thank you Paul

    Now it's almost perfect.

    I have now added:
    "/q /v C:\Users\XXXXXX\Unterlagen /l F /p {password}"
    without brace {}

    I always had a different colored icon in the taskbar at the clock, I'd love to have this again.

    This is now no longer available.

    I would like to thank you again to all who have helped me.

  • IchHier

    IchHier - 2012-11-27


    now it runs, it had only the background task will be operated by windows start.
    So I now see the entry:
    /q /v C:\Users\XXXXX\Unterlagen /l F /p {password} /q

    EDIT: /q = we in the end probably not needed because, I have now but let off

    Thanks again to all who have helped me.

    Greeting IchHier

    Last edit: IchHier 2012-11-27
  • mranybody

    mranybody - 2012-11-29

    Hold on a sec.

    I've had the following sequence in the URL field of each of my TrueCrypt volumes for some time, and all works well:

    cmd://"C:\Program Files\TrueCrypt\TrueCrypt.exe"/q /v "VOLUME PATH" /l H /p {REF:P@I:REF TO VOLUME ENTRY}

    Two things I'm not happy with (despite the applicable options being checked in TrueCrypt preferences):
    Firstly, The volume mounts in the background without opening in a new window. Therefore, I then have to go to My Computer to open the volume.
    Secondly, the volume is not mounted as removable media. As a result, I have to then open the TrueCrypt UI to dismount the volume.

    Do any of the strings in the above posts solve these?

    Many thanks.

    Last edit: mranybody 2012-11-29
  • steelej

    steelej - 2012-11-30

    I am bee experimenting with Truecrypt command line options within a trigger. This have been tested on Vista

    Changing the command line switch /q to /q background leaves Truecrypt running in the Notification area enabling this to be easily accessed to dismount the volume

    If you want the volume to be a removable volume add the switch /m removable

    Here is my version in the arguments field in the trigger.

    /v "{REF:A@I:629383C0A4AF654491CB401E254974A5}" /lt /p "{REF:P@I:629383C0A4AF654491CB401E254974A5}" /q background /m removable

    I have a KeePass database entry which contains the file path to the Truecrypt container file in the URL field, and the password in the password field. It mounts the container as the T drive.

  • mranybody

    mranybody - 2012-11-30


    Rockin'. Your 2 additions of /q background /m removable solve both the issues I mention. Huge thanks for your help with this.

    While I don't get a new window on the Volume opening (which would be my preference), the TC now in my Notification Area gives me easy access.

    cmd://"C:\Program Files\TrueCrypt\TrueCrypt.exe"/v "VOLUME PATH" /lS /p {REF:P@I:REF TO VOLUME ENTRY} /q background /m removable

    I might follow your version of using REF:A@I: instead of the Volume Path, but for now the mounted volume (as S:\ in my case) is as removable media, and Truecrypt is in my Notification area for easy dismount.


  • steelej

    steelej - 2012-11-30

    If you want the Truecrypt window to open then try /a instead of /q background (or jusr /q)

  • Paul

    Paul - 2012-12-01

    Add "/e" to open a Windows Explorer window on mount.
    cmd://"C:\Program Files\TrueCrypt\TrueCrypt.exe"/q /v "VOLUME PATH" /l H /p {REF:P@I:REF TO VOLUME ENTRY} /e /m removable

    cheers, Paul

  • mranybody

    mranybody - 2012-12-01

    Steelej and Paul,

    Man, I don't think this could get any better! .....or can it!?!?

    From your replies, I'm now using:
    cmd://"C:\Program Files\TrueCrypt\TrueCrypt.exe"/q background /v "VOLUME PATH" /l S /p {REF:P@I:REF TO VOLUME ENTRY} /e /m removable

    /a instead of /q background does the above, but opens the TrueCrypt UI, I chose not to use that. My preference was for a new window (Windows Explorer) to open with the mounted drive. /e does that great. With the above string I have access to TC in the Notification Area for easy dismount (/q background) and the mounted volume in a new window (/e).


    Huge thanks to you both.

  • Emm

    Emm - 2013-08-09

    OK, Thanks Paul for directing me here.

    After some tries and reading previous posts here's how I did things:

    Create an entry:
    Name it the way you want
    Username should be the path to the container, enclose it in quotes if it contains spaces
    Password should be the actual password to the container
    URL can be the path to a keyfile (if such is used) or empty, I've put in the path to TrueCrypt.exe since I use it portably and I don't use keyfiles.
    Notes should contain switches other than /v and /p which are necessary by default
    Copy the UUID from the Properties Tab, will be referenced as UUID from here on.
    Save / OK

    To mount the container use a trigger: Tools > Triggers
    NOTE: triggers are saved in KeePass.config.xml, so anything you add here is unencrypted!
    Add a trigger
    Name it the way you want, but make it something elusive
    Enabled ticked, Initially on ticked, Turn off unticked
    Events: Opened database file, no parameters needed
    No Conditions
    Actions: Execute command line / URL
    parameter File:{REF:A@I:UUID}
    parameter Arguments:/v {REF:U@I:UUID} {REF:N@I:UUID} /p {REF:P@I:UUID}
    parameter Wait for exit: unticked
    OK & Finish

    {REF:A@I:UUID} is the URL field, since I used the TrueCrypt.exe path I've put it here. Instead of this could be the actual path and {REF:A@I:UUID} can be used as a keyfile reference. It makes it harder to figure out TrueCrypt is being used on a quick glance. This works if the /q or /quit argument is used and TrueCrypt doesn't show in system tray.

    {REF:U@I:UUID} is the Username field or the path to the container file
    {REF:N@I:UUID} are switched presented as Notes
    {REF:P@I:UUID} is the password, obviously

    Now if the parameters or the container is changed one only need to edit the entry and not the trigger itself while keeping all things neat.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks