EnvironmentVariables.SetValue
-----------------------------

Sets an environment variable.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [EnvironmentVariables](component_EnvironmentVariables.md) | [5.1](newinversion51.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "EnvironmentVariables.SetValue"; Name; Value ) 

**MBS**( **"EnvironmentVariables.SetValue";** /\* Sets an environment variable. \*/  
**$Name**; /\* The name of the environment variable.e.g. "test" \*/   
**$Value**) /\* The new value as text.e.g. "Hello" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Name | The name of the environment variable. | "test" |
| Value | The new value as text. | "Hello" |

### Result

Returns OK or error.

### Description

Sets an environment variable.  
Only visible within FileMaker application and subprocesses launched after the change.  
  
For Python on macOS or Linux, you can use EnvironmentVariables.SetValue to set variables before you load python. But for Windows this won't work.  
### Examples

Set a new Variable:

 MBS ( "EnvironmentVariables.SetValue"; "test"; "Hello World" )  
Disable referral chasing during queries to the LDAP server:

 MBS ( "EnvironmentVariables.SetValue"; "LDAPREFERRALS"; "off" )  
### See also

- [EnvironmentVariables.ClearValue](EnvironmentVariablesClearValue.md)
- [EnvironmentVariables.Name](EnvironmentVariablesName.md)
- [EnvironmentVariables.Names](EnvironmentVariablesNames.md)
- [EnvironmentVariables.Value](EnvironmentVariablesValue.md)
- [LDAP.Connect](LDAPConnect.md)

### Example Databases

- [Utility functions/Environment Variables](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Utility%20functions/Environment%20Variables.shtml#1GroupButton18.0000000540.000000043.0000000631.0000000LayoutObjectAnchor_)

This function is free to use.

Created 8th April 2015 , last changed 13th February 2026

  
[EnvironmentVariables.Names](EnvironmentVariablesNames.md) - [EnvironmentVariables.Value](EnvironmentVariablesValue.md)

[HTML Version](EnvironmentVariablesSetValue.shtml)