Files specified in the command line are searched in the working directory...
A lightweight and easy-to-use password manager
Brought to you by:
dreichl
I usually work with two password databases.
I launch keepass2 v2.35 as "keepass2 db1.kdbx" from directory "dir1", and then if I move to a different directory and "run keypass2 db2.kdbx", keypass2 tries to find "dir1/db2.kdbx", instead of using the current directory.
This forces me to specify a full path, which is slightly inconvenient.
This is not a bug. KeePass creates a new environment that is inherited from the parent process (e.g. command processor), it does not share the parent's environment. Consequently changing the working directory in the parent process does not affect the child process (KeePass) working directory.
However you can run separate instances (workspaces) of KeePass. Each new KeePass instance will inherit the then current working directory from the command process. To do this uncheck 'limit to singe instance' in 'Tools>Options>Advanced(tab)>Start and Exit'. Then exit KeePass. The setting will be active the next time KeePass starts.
Last edit: wellread1 2015-02-11
Well, keepass2 could consider the CWD and pass it on to the current instance when you call it a second time, along with the rest of parameters that are currently being sent indeed.
I guess in ActivatePreviousInstance, the CWD could be passed when creating "IpcParamEx ipcMsg = new IpcParamEx(IpcUtilEx.CmdOpenDatabase, CommandLineArgs.SafeSerialize(vFlt), null, null, null, null);".
The merits of one convention versus another is a topic for the discussion forum.
Well, this is the behavior of for example Qt Creator.
I will try to take a look at the code and see if I can make a proposal.
Ticket moved from /p/keepass/bugs/1350/