KeePass   KeePass Help Center Home KeePass Home | Package Downloads | Flag Translations | Blocks Plugins  
Home Help Center Home | People Forums | Award Awards | Search Search  






Donate Donate
Console

Single Command Operations


How to use KPScript with single command operations to perform simple database operations.

KPScript can be invoked using single commands. By passing the database location, its key, a command and eventually some parameters, simple operations like adding an entry can be performed. The syntax is very simple, no scripting knowledge is required. This method is ideal when you quickly want to do some small changes to the database. It is not recommended when you need to perform many operations, because for each command the database needs to be loaded from file, decrypted, modified, encrypted and written back to file.

Commands are specified by passing -c:COMMAND to KPScript, where COMMAND is the command to execute (see below for a list of available commands).

The database location is passed to KPScript by just passing it as a parameter, without any option prefix.

The composite key for the database can be given to KPScript using one of the following ways:

  • Command Line Parameters.. Using the -pw:, -keyfile: and -useraccount parameters. For example, to pass "Secret" as password, you'd give KPScript the following parameter: -pw:Secret. If the password contains spaces or other special characters, it must be enclosed in quotes: -pw:"My Top Secret Password". Similarly, the -keyfile: parameter can specify the key file location. If -useraccount is passed to KPScript, the user account credentials of the currently logged on user are used, otherwise not.

  • Entering interactively using the command line. If you pass -keyprompt to KPScript, it will prompt you for the key. You can enter the password, key file location and user account directly in the console window.

  • Entering interactively using graphical user interface. If you pass -guikeyprompt to KPScript, it will prompt you for the key using the standard key dialog of KeePass.

Available Commands:

Please note that commands are added incrementally based on user requests. If you are missing a command, please let the KeePass team know and it will be added to the next release of KPScript.

Currently, the following commands are available:

  • ListGroups
  • ListEntries
  • AddEntry

Command: ListGroups

This command lists all groups in a format that easily machine-readable. The output is not intended to be printed/used directly. Usage examples:

KPScript -c:ListGroups "C:\KeePass\MyDb.kdbx" -pw:MyPassword
This will list all groups contained in the MyDb.kdbx database file.


Command: ListEntries

This command lists all entries in a format that easily machine-readable. The output is not intended to be printed/used directly. Usage examples:

KPScript -c:ListEntries "C:\KeePass\MyDb.kdbx" -pw:MyPassword -keyfile:"C:\KeePass\MyDb.key"
Opens the MyDB.kdbx database using MyPassword as password and the MyDb.key file as key file. It will output a list of all entries contained in the MyDb.kdbx database file.


Command: AddEntry

This command adds an entry to the database. To specify the entry details, use the standard string field identifiers as parameter names and their values for the contents. Supported standard string fields are: Title, UserName, Password, URL, and Notes. Usage examples:

KPScript -c:AddEntry "C:\KeePass\MyDb.kdbx" -pw:MyPw -Title:"New entry title"

KPScript -c:AddEntry "C:\KeePass\MyDb.kdbx" -pw:MyPw -Title:SomeWebsite -UserName:Don -Password:pao5j3eg -URL:http://website.com

The -GroupName: parameter can be used to specify the group in which the entry is created. For searching, KPScript performs a pre-order traversal and uses the first matching group (the name is case-sensitive). If no group with the specified name is found, it will be created in the root group. If you do not specify a group name, the entry will be created in the root group. Example:

KPScript -c:AddEntry "C:\KeePass\MyDb.kdbx" -pw:MyPw -Title:"My Provider" -GroupName:"Internet Sites"





Valid XHTML 1.0 Transitional Document

Get Thunderbird

Get KeePass


KeePass is OSI Certified Open Source Software
Copyright © 2003-2008
Dominik Reichl, [Legal Contact] [Disclaimer] [Acknowledgements], Downloads hosted at

SourceForge.net Logo