Script Control of the PasswordGenerator
In addition to creating passwords using the program's graphical user interface, the PasswordGenerator in its desktop version also offers the option of generating passwords within scripts or via the command line. We will explain how this works in the following.
- How to start the Password Generator in Batch Mode
- Influence the Length of the Password
- Influence the Character Classes used for the Password
- Load Configuration Files
- Overview of all available Parameters
To put the Password Generator in batch mode, only one parameter is required. Simply call the Password Generator via the command line or within a script with the parameter -cl (stands for command line):
With this, the Password Generator starts in batch mode without a graphical user interface. The program automatically generates a password immediately after starting, outputs this via the command line and then exits itself again.
Since this call does not contain any further parameters, the standard settings are used for generating the password. These are either the default settings of the Password Generator or the start settings, if you have saved any.
Influence the Length of the Password
The first interesting parameter with which you can set the desired length of your password is the parameter l. Simply write after l= how long your password should be. A call can look like this, for example:
PasswortGenerator -cl l=16
With this line you create a password with 16 characters. In addition, the default settings of the Password Generator are used for the password. If you omit the "l" parameter, the default settings are used for the password length.
Influence the Character Classes used for the Password
In the PasswordGenerator there are 4 character classes available for your passwords: uppercase letters, lowercase letters, digits and special characters. With the parameter "c" (for character classes) you can determine in batch mode from which character classes your password should be built.
For each character class there is a letter: u (uppercase) stands for uppercase letters, l (lowercase) stands for lowercase letters, d (digits) for numbers and s (special characters) for special characters. The letters can be freely combined with each other.
You can specify the letters for all character classes if characters from all character classes should be used for your password:
PasswortGenerator -cl c=ulds
If only uppercase letters, lowercase letters and numbers should be used, omit the s for special characters:
PasswortGenerator -cl c=uld
If only digits should be used, just pass only the d (digits) as a parameter:
PasswortGenerator -cl c=d
The parameters can be mixed freely. If you need, for example, an 8-character password consisting of uppercase and lowercase letters, you can use the following command:
PasswortGenerator -cl l=8 c=ul
Furthermore, you can use the parameter a to determine whether the password must always contain characters from all specified character classes (a=1) or not (a=0). The following command could therefore also result in passwords such as A1X89D, although all character classes are selected:
PasswortGenerator -cl l=6 c=ulds a=0
If you omit the parameters "c" or "a" or leave them completely empty, the default settings of the PasswordGenerator are used.
You can specify which characters are used for the individual character classes in the program settings via the graphical user interface. If these are then saved as start-up settings, your settings will also be used automatically in batch mode. Alternatively, you can also transfer a configuration file directly, as explained in the next section.
Load Configuration Files
Settings that you have made via the graphical user interface of the Password Generator can be saved via Settings > Save as a file in the *.pgs format (Password Generator Settings). In addition to the length and the character classes used, you can also define, for example, which characters should belong to which character class.
To use these configuration files in batch mode, they only have to be passed as parameters as follows:
PasswortGenerator -cl config.pgs
If the configuration file is not in the same directory as the program file, the path to the file must of course also be specified:
PasswortGenerator -cl c:\ordner\config.pgs
The configuration files can be used freely with any other parameters:
PasswortGenerator -cl config.pgs l=20 c=ds
The following applies: First, the default settings of the Password Generator are loaded. If available, these will be overwritten with the start settings. These are then in turn overwritten by any configuration files that may have been passed (the settings files can also only contain parts of the possible settings). Last the settings are overwritten with the parameters. The parameters always have the highest priority.
Overview of all available Parameters
In summary, the following table provides an overview of all available parameters that you can use in the batch mode of the Password Generator.
|l||Numbers > 0||Standard setting of the program||Desired length of the password. For example, you can use l=10 to create a 10-character password.|
|c||u, l, d, s - freely combinable||Standard setting of the program||Desired character classes for the password. The individual letters stand for uppercase letters (u), lowercase letters (l), digits (d) and special characters (s) and can be freely combined with one another. For example, you can use c=ulds for passwords made of all character classes, c=ul for passwords with uppercase and lowercase letters, or c=d for passwords that only consist of digits.|
|a||0 or 1||Standard setting of the program||Should at least one character from each specified character class be used for each password? Yes (1) or No (0).|
|[Files]||Configuration files with the extension PGS||Standard setting of the program||Configuration file that can be created with the Password Generator and that can contain all settings including the characters used for the individual character classes.|
All available parameters can be combined with one another as required. The parameters l and c have a higher priority than possible configuration files.