Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 CLI Reference | 2025.1

# P4CONFIG

Contains a file name without a path. The specified file is used to store other P4 Server environment variables.

The current working directory (returned by `PWD`) and its parents are searched for the file. If a file is found, the variable settings within the file are used. If additional files are found in parent directories, and they contain variable settings not already found in other files, those variable settings are also used.

## Usage notes

Used by Client? | Used by Server? | Command-Line Alternative | Can be set in P4CONFIG file?
--- | --- | --- | ---
Yes | No | None | N/A

## Value if not explicitly set

Operating System | Value
--- | ---
All | If not set, this variable is not used.

## Example

1. Create a file, such as `.p4config.txt` in your client root directory.

2. Set `P4CONFIG` to use the file that you created: `p4 set P4CONFIG=.p4config.txt`

A sample `P4CONFIG` file might contain the following lines:

    P4CLIENT=marias_client
    P4USER=maria
    P4PORT=ssl:ida:3548

## Notes

P4CONFIG makes it easy to switch P4 Server settings when switching between different projects. If you place a configuration file in each of your client workspaces and set `P4CONFIG` to point to that file, your P4 Server settings change to the settings in the configuration files automatically when you move from directories in one workspace to another.

Common settings can be placed into a configuration file in a parent directory. These settings can be overridden by setting them in configuration files in child directories.

The file defined by `P4ENVIRO` contains the same kind of information as the `P4CONFIG` file. However,

- the `P4CONFIG` variable contains only the file name of a configuration file, and the system searches through successive parent directories
- the `P4ENVIRO` variable contains the exact location and name of a configuration file if it is not at its default location

Each line in the configuration file defines one variable. The definition takes the form ``variable`=`value``.

You can use both `P4CONFIG` and `P4ENVIRO` files to define environment variables:

- use the `P4CONFIG` file for those variables that have different values for different workspaces

- use the `P4ENVIRO` file for those variables that remain constant for all projects.

Values set in a `P4CONFIG` file override those set in a `P4ENVIRO` file.

Common variables to set within a `P4CONFIG` file include:

`P4CHARSET` | `P4CLIENT` | `P4DIFF`
`P4EDITOR` | `P4HOST` | `P4LANGUAGE`
`P4MERGE` | `P4PASSWD` | `P4PORT`
`P4TICKETS` | `P4USER` |

For a complete list of valid `P4CHARSET` values, issue the `p4 help charset` command.

### Ignored lines

The follow types of lines are ignored:

- lines that begin with `#`, which can be used for comments

- duplicates of the same variable, such as P4PORT. Only the first occurrence is used.

Your search for returned results