---
schema_version: "1"
id: caccd5a2770a4c6771a926b30e8452ec9a2bf631b780f0583982224c79ed8251
title: CLI Parameter Resolution Order
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfdx-setup/guides/sfdx-dev/workspace-setup/sfdx-dev-cli-param-resolution.md
canonical_url: https://developer.salesforce.com/docs/platform/sfdx-setup/guide/sfdx-dev-cli-param-resolution.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 5e9cae6c8bbd7f136a4ef775a97585ddf3edf39a06aefe2d0154c805b0c95fd5
products:
  - Salesforce CLI Setup Guide
  - salesforcedx
---

# CLI Parameter Resolution Order

Because you can specify parameters for a given Salesforce CLI command in several ways, it’s important to know the order of resolution.

Salesforce CLI resolves command-line flags and arguments, definition files, environment variables, and settings in this order, which means items at the top of the list take precedence over items lower down:

- Command-line flags such as `--target-org`.
- Options listed in a file specified at the command line. An example is a scratch org definition in a file, which you specify with the `--definition-file` flag of `org create scratch`. If you specify a flag at the command line, such as `--edition`, whose value differs from what exists in the definition file, the command-line flag takes precedence.
- Environment variables, such as SF_TARGET_ORG.
- Local configuration variables, such as `target-org` or `target-dev-hub`. To view the local configuration variables, run `sf config list` from your project directory.
- Global CLI configuration variables. To view the global configuration variables, run `sf config list --global` from any directory.

Remember, command-line flags are at the top of the precedence list. For example, let’s say you set the SF_TARGET_ORG environment variable to `myorg@mydomain.com`. If you specify `--target-org myotherorg@myotherdomain.com` when you run a command, it connects to an org with the `myotherorg@myotherdomain.com` username.

Similarly, let’s say you set the configuration variable `target-org` to `myorg@mydomain.com`. If you specify `--target-org myotherorg@myotherdomain.com` when you run a command, you connect to an org with the `myotherorg@myotherdomain.com` username.

**See Also**

- [Configuration Variables](https://developer.salesforce.com/docs/platform/sfdx-setup/guide/sfdx-dev-cli-config-values.md)
- [Salesforce CLI Environment Variables](https://developer.salesforce.com/docs/platform/sfdx-setup/guide/sfdx-dev-cli-env-variables.md)
