---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../modules.md) / [config](../index.md) / loadEnvFileForArgv

# Function: loadEnvFileForArgv()

> **loadEnvFileForArgv**(`argv`, `env`): [`LoadedEnvFile`](../interfaces/LoadedEnvFile.md) \| `undefined`

Defined in: [packages/b2c-tooling-sdk/src/config/project-environment.ts:116](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/bceb8da43dd8bc63d57932bbd905d36a1b40c949/packages/b2c-tooling-sdk/src/config/project-environment.ts#L116)

Selects the env file for a command line and applies it without overriding
variables that are already set.

`--dotenv-file` / `SFCC_DOTENV_FILE` select the file; otherwise
`<--project-directory>/.env` or `./.env` applies.

## Parameters

### argv

`string`[]

### env

`Record`\<`string`, `string` \| `undefined`\> = `process.env`

## Returns

[`LoadedEnvFile`](../interfaces/LoadedEnvFile.md) \| `undefined`

## Throws

Error if an explicitly selected file does not exist
