---
url: /reference/cli/variables-set.md
---

# variables set

设置环境变量

## 使用

```shell
Usage: nexus variables set [options] [key] [value]
```

## 选项

```shell
-v, --verbose                    enable verbose mode
-e, --environment <environment>  specify the environment (see your default environment by running nexus settings list)
--encrypt                        encrypt the variable value so it is masked when listed
--non-interactive                run the command without input prompts
-h, --help                       display help for command
```

## 示例

设置环境变量

```shell
nexus variables set
```

指定 development 环境设置加密环境变量：键为 `KEY1` ，值为 `value1`

```shell
nexus variables set KEY1 value1 -e development --encrypt
```
