---
schema_version: "1"
id: 37ffa73f5c3882fff5369816f569ba289cc6f3cfb81319daea5a8340c72bb62f
title: envVar
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.7/dw-system-functions-envvar.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.7/dw-system-functions-envvar
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 401d1fcce443e8bcf8c1dadc4f7a72cf66fd6d4237c9daa50003a8b41b9a1d47
description: MuleSoft Documentation Site
release: "2.7"
latest: false
---
# envVar

## [](#envvar1)envVar(variableName: String): String | Null

指定された名前の環境変数を返すか、環境変数が定義されていない場合は ​`null`​ を返します。

### [](#パラメーター)パラメーター

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 75%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">名前</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>variableName</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">環境変数の名前を指定する文字列。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、Mac コマンドコンソール (​`SHELL`​) のパスを返し、​`FAKE_ENV_VAR`​ (定義されていない環境変数) に対して ​`null`​ を返します。 `SHELL`​ は、標準 Mac 環境変数の 1 つです。また、​`import`​ コマンドにより、先頭にモジュール名を追加しなくても関数をコールできることにも注目してください。

#### [](#ソース)ソース

```DataWeave
%dw 2.0
import * from dw::System
output application/json
---
{
    "envVars" : [
       "real" : envVar("SHELL"),
       "fake" : envVar("FAKE_ENV_VAR")
    ]
}
```

#### [](#出力)出力

```JSON
"envVars": [
  {
    "real": "/bin/bash"
  },
  {
    "fake": null
  }
]
```