# Remove Environment Variable

> Removes a Windows environment variable, or a single entry from a list style variable such as Path.\n\nUse it to clean up after an application, for example to remove the.

Source: https://docs.capaone.com/capaone/application-manager/powerbricks/bricks/remove-environment-variable/  
Product: CapaOne — a separate CapaSystems product; do not apply this page to any other.

Removes a Windows environment variable, or a single entry from a list style variable such as Path.\\n\\nUse it to clean up after an application, for example to remove the folder an application added to Path when it was installed. The whole Path variable can never be deleted by this brick, only single entries can be removed from it.\\n\\nEvery program started after the brick has run sees the variable as it is now. Programs a signed-in user already has open keep the old value until they are restarted, and signing out and back in is the reliable way to refresh all of them.

## Parameters

#### Variable Name
*Required*

The name of the environment variable to work on.\\n\\nExample: MYAPP_HOME\\n\\nTo clean up a folder that was added to the search path, enter Path here and turn on "Remove Entry Only". The Path variable itself is never deleted.

#### Remove Entry Only
*Optional* — Default: `False`

Enable to remove only the single entry given below from a list style variable such as Path or PSModulePath, and leave the rest of the value untouched.\\n\\nDisable to remove the whole variable. The variable named Path can never be removed as a whole, so this must be enabled when working on Path.

#### Entry To Remove
*Optional*

The single entry to strip out of the variable. Required when "Remove Entry Only" is enabled, and must be left empty otherwise.\\n\\nExample: C:\\Program Files\\MyApp\\bin\\n\\nThe entry is matched without regard to upper or lower case and a trailing backslash is ignored, so C:\\Program Files\\MyApp\\bin\\ matches the example above. Every other entry keeps its original order.

#### Continue If Not Found
*Optional* — Default: `True`

Enable to let the workflow continue when the variable, or the entry, is already gone. The step is written to the log and reported as a success.\\n\\nDisable to fail the workflow when there was nothing to remove. Keep this enabled in an uninstall workflow that may run on computers where the variable was never created.

## Details

- **Category:** System
- **Brick ID:** `Environment-Variable-Remove`

## Raw JSON definition

```json
{
  "category": "system",
  "description": "Removes a Windows environment variable, or a single entry from a list style variable such as Path.\\n\\nUse it to clean up after an application, for example to remove the folder an application added to Path when it was installed. The whole Path variable can never be deleted by this brick, only single entries can be removed from it.\\n\\nEvery program started after the brick has run sees the variable as it is now. Programs a signed-in user already has open keep the old value until they are restarted, and signing out and back in is the reliable way to refresh all of them.",
  "developerVendor": "CapaSystems A/S",
  "displayName": null,
  "id": "Environment-Variable-Remove",
  "name": "Remove Environment Variable",
  "parameters": [
    {
      "allowManualInput": false,
      "defaultValue": "",
      "defaultValueObject": null,
      "description": "The name of the environment variable to work on.\\n\\nExample: MYAPP_HOME\\n\\nTo clean up a folder that was added to the search path, enter Path here and turn on \"Remove Entry Only\". The Path variable itself is never deleted.",
      "id": "VariableName",
      "name": "Variable Name",
      "regExValidation": "",
      "required": true,
      "type": "TextBox",
      "value": null,
      "values": [],
      "valuesObject": null
    },
    {
      "allowManualInput": false,
      "defaultValue": "False",
      "defaultValueObject": null,
      "description": "Enable to remove only the single entry given below from a list style variable such as Path or PSModulePath, and leave the rest of the value untouched.\\n\\nDisable to remove the whole variable. The variable named Path can never be removed as a whole, so this must be enabled when working on Path.",
      "id": "RemoveFromPathOnly",
      "name": "Remove Entry Only",
      "regExValidation": "",
      "required": false,
      "type": "Boolean",
      "value": null,
      "values": [],
      "valuesObject": null
    },
    {
      "allowManualInput": false,
      "defaultValue": "",
      "defaultValueObject": null,
      "description": "The single entry to strip out of the variable. Required when \"Remove Entry Only\" is enabled, and must be left empty otherwise.\\n\\nExample: C:\\Program Files\\MyApp\\bin\\n\\nThe entry is matched without regard to upper or lower case and a trailing backslash is ignored, so C:\\Program Files\\MyApp\\bin\\ matches the example above. Every other entry keeps its original order.",
      "id": "PathEntry",
      "name": "Entry To Remove",
      "regExValidation": "",
      "required": false,
      "type": "TextBox",
      "value": null,
      "values": [],
      "valuesObject": null
    },
    {
      "allowManualInput": false,
      "defaultValue": "True",
      "defaultValueObject": null,
      "description": "Enable to let the workflow continue when the variable, or the entry, is already gone. The step is written to the log and reported as a success.\\n\\nDisable to fail the workflow when there was nothing to remove. Keep this enabled in an uninstall workflow that may run on computers where the variable was never created.",
      "id": "ContinueIfNotFound",
      "name": "Continue If Not Found",
      "regExValidation": "",
      "required": false,
      "type": "Boolean",
      "value": null,
      "values": [],
      "valuesObject": null
    }
  ],
  "powershell": {
    "base64Encoded": true,
    "function": "ZnVuY3Rpb2..."
  },
  "type": "powerbrick",
  "version": "2026.10.8.1"
}
```
