Launcher cmd for %programfiles% and %programfiles(x86)% and I'm confused as heck...

Oscar
2014-07-31
2014-08-01
  • Oscar
    Oscar
    2014-07-31

    I've been using Keepass 1.22 and have the following command in the URL field:
    cmd://"%PROGRAMFILES%\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe" -s {TITLE} -u {USERNAME} -p {PASSWORD}
    Always works with 1.22. Launches the app and puts in the credentials.

    I just migrated the database to the latest version of Keepass 2 and it doesn't work.

    I checked the path and VMware isn't located in %programfiles%. It's located in %programfiles(x86)%. Which explains why it isn't working with Keepass 2. But it creates a new question... why does it work with Keepass 1.22?!?

    To clarify the launcher command above works for 1.22 but not for 2. The actual path is
    C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher

    Can anyone explain this? Any suggestion for how I change dozens of these launcher commands in the database to the correct reference?

    Should I forget about the path and just add the path to the Windows path and use just the exe instead? This brings me back to asking what is the best way to fix all of these in one stroke?

    Thanks in advance

    Oscar

     
  • Dominik Reichl
    Dominik Reichl
    2014-07-31

    KeePass 1.x is a 32-bit application, thus %PROGRAMFILES% maps to 'C:\Program Files (x86)' when running on a 64-bit operating system. In contrast, on a 64-bit operating system KeePass 2.x runs as a 64-bit application, thus %PROGRAMFILES% maps to 'C:\Program Files'.

    In order to make it work on all systems (32- and 64-bit), use {ENV_PROGRAMFILES_X86} instead of %PROGRAMFILES%. This placeholder is documented on
    http://keepass.info/help/base/placeholders.html#envctx

    To change them all quickly, go 'Tools' -> 'Database Tools' -> 'XML Replace', select nodes '//Entry/String[Key='URL']/Value' (without the outer ''), replace data in inner text, find '%PROGRAMFILES%\VMware\Infrastructure', replace with '{ENV_PROGRAMFILES_X86}\VMware\Infrastructure', not case-sensitive and not as regular expressions.

    Of course, make a backup before doing this, in case anything goes wrong.

    Even better than the above would be to create an URL scheme override (in 'Tools' -> 'Options' -> tab 'Integration' -> button 'URL Overrides'), e.g. override the scheme 'vmcli' by 'cmd://"{ENV_PROGRAMFILES_X86}\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe" -s {TITLE} -u {USERNAME} -p {PASSWORD}'; then it's sufficient to set the entry's URL to 'vmcli://'.

    Best regards,
    Dominik

     
  • Oscar
    Oscar
    2014-08-01

    Thanks for the fast and clear response. Have a great day.

    Sincerely,

    Oscar