Use custom variables
Custom variables are named values stored in your workspace or in one of its vaults. With Devolutions CLI, you can list them, set them from a script, and export them, without opening Devolutions Remote Desktop Manager.
These commands work on the current context. To use another local profile for one command, add --context <context-name>. See Switch between workspaces.
Pick the right command
devo workspace variable
Lists, sets, or deletes the custom variables of the current workspace.
The variable belongs to the whole workspace.
devo vault variable
Lists, sets, or deletes the custom variables of the current vault, or of the vault you name with --vault.
The variable belongs to one vault.
devo variable export
Writes the custom variables of one scope to a JSON file.
You want a copy of the variables, for example to review them or keep them with a script.
List variables
devo workspace variable list
devo vault variable list --vault "<vault-name>"The table shows the name, value, scope, source, and description of each variable. To keep only some of them, add a name filter: * matches any text and ? one character, and the case doesn't matter.
devo workspace variable list "API_*"Without --vault, devo vault variable list uses the current vault. To select the vault by ID, write --vault id:<vault-id> or add --id.
Create or update a variable
set creates the variable if it doesn't exist and updates it otherwise. The value comes from an environment variable (--value-env) or a file (--value-file), never from the command line, so it doesn't end up in your shell history. Use one of the two, not both.
For a vault variable, use devo vault variable set with the same options, plus --vault "<vault-name>" to pick a vault other than the current one.
Name: letters, digits, and underscores only. The
$delimiters are optional:API_REGIONand$API_REGION$are the same variable. Devolutions CLI saves the name in uppercase, between$signs.Value from a file: the whole content of the file becomes the value, as is, including a final line break if the file ends with one.
Value from a variable: the environment variable must exist. Devolutions CLI stops if it isn't set.
Confirmation: without
--yes(or-y,--confirmed), the command changes nothing and returnsconfirmationRequired.
Delete variables
You can name several variables in one command. If one of them doesn't exist, or a name appears twice, the command fails and deletes nothing. Without --yes, nothing is deleted.
Export variables to a file
--scope
Required. Which variables to export: workspace, vault, user-vault, or option.
--out-file
Required. The JSON file to write. Its folder must already exist.
--name
Keeps only the variables whose name matches. Accepts * and ?.
--vault, --id
For the vault and user-vault scopes, the vault to export. Without it, the current vault.
--force
Replaces the file if it already exists. Without it, the command stops.
The file lists each variable with its name, value, description, scope, and source. Exporting reads the variables only: it doesn't need --yes, and you can export every scope, even the ones you can't change from Devolutions CLI.
Good to know
setanddeletechange theworkspaceandvaultscopes only.Changes need an unencrypted local database. When the profile can't be changed safely, the command explains why and changes nothing.
Add
--output jsonto read the result in a script. See Read results as JSON.A command refused on your workspace type: see A command says the workspace doesn't support it.
Next
Every option of these commands: Commands
Last updated
Was this helpful?