p4 set

Set Helix server system variables.

Syntax conventions

p4 [g-opts] set [-q] [-s] [-S svcname] [var=[value]]

Description

Both Helix server client applications and the shared versioning service make use of certain system variables. Depending on the operating system and other factors, variable definitions may be stored in the file defined by P4CONFIG, in the file defined by P4ENVIRO, or in the Windows registry.

  • On Linux, values defined with p4 set are stored in the P4ENVIRO file.
  • On Windows, values defined with p4 set are stored in the P4ENVIRO file if this is set. If it is not set, they are stored in the Windows registry.

    Windows administrators running Helix server as a service can set environment variables used by the service with p4 set -S svcname var=value. These variables are always stored in the Windows registry.

    To change a variable setting that applies to the current user, use p4 set var=value. Administrators can use p4 set -s var=value to set the variable’s default values for all users on the machine.

Precedence

Tip

You can specify client settings such as port, user, and workspace names by using any of the following:

  1. On the command line, using options.
  2. In the configuration file(s) specified by a P4CONFIG environment variable, where each config file can be specific to a workspace.
  3. In the P4ENVIRO configuration file, which is for variables that remain constant for all the workspaces on a given computer.
  4. User environment variables.
  5. System environment variables (on Windows, system-wide environment variables are not necessarily the same thing as user environment variables)
  6. In the user registry or settings set by issuing the p4 set command.
  7. In the system registry or system settings set by issuing the p4 set -s command.

where

The output of p4 set lists the values of the variables (and if a given variable was set by config, enviro, set, or set -s).

Unsetting and viewing variable values

To unset the value for a particular variable, leave value empty.

To view a list of the values of all Helix server variables, use p4 set without any arguments. If a P4CONFIG file was used to set the variable, its location is displayed.

  • On UNIX, this displays the values of the associated environment variables.
  • On Windows, this displays either the environment variable (if set), or the value in the registry and whether it was defined with p4 set (for the current user) or p4 set -s (for the local machine).

Note how the source of the variable definition is shown in this sample output to the p4 set command. If no source is given, the value is stored in the variable itself rather than in a file containing the definition.

P4CLIENT=symlinks-nix (config)
P4CONFIG=p4config.txt (config '/home/perforce/p4clients/symlinks-nix/p4config.txt')
P4EDITOR=/usr/bin/vi
P4IGNORE=p4ignore.txt (enviro)
P4PORT=win-bruno:20151 (config)
P4USER=bruno (set -s)
P4_20151_CHARSET=none (set)

Options

-q

Reduce the output.

When listing files, don’t display the origin of the setting. The output is suitable for parsing with scripts.

-s

Set the value of the registry variable for the local machine.

On Windows, without this option, p4 set sets the variables in the HKEY_CURRENT_USER hive. When you use the -s option (and have Windows administrative privileges), the variables are set in the HKEY_LOCAL_MACHINE hive.

The location is reflected in the output of p4 set on Windows.

-S svcname

Set the value of the registry variables as used by service svcname. You must have Windows administrator privileges to do this.

g-opts

See Global options.

Usage Notes

Can File Arguments Use Revision Specifier? Can File Arguments Use Revision Range? Minimal Access Level Required

N/A

N/A

none

  • You’ll find a listing and discussion of the Helix server variables in the Environment and registry variables section of this manual.
  • Changes to registry settings under Windows affect the local machine only. An administrator setting P4JOURNAL for a Helix server Windows service must be present at the machine running the service. See also the Knowledge Base article, "Windows Environment Variable Precedence".
  • If you’re working in a UNIX-like environment on a Windows machine (for example, Cygwin), use environment variables instead of p4 set. (In these cases, the Helix server Command-Line Client behaves just as though it were in a UNIX environment.)

Examples

p4 set

On all platforms, display a list of Helix server variables and their origins without changing their values.

p4 set -q

On all platforms, display a list of Helix server variables in a format suitable for scripts to parse without changing their values.

p4 set P4MERGE=

On Windows or OS X, unset the value of P4MERGE.

p4 set P4PORT=ssl:tea:1666

On Windows, set a variable telling Helix server applications to connect to a Perforce service at host tea, port 1666, via SSL.

The variable is set only for the current local user.

p4 set -s P4PORT=ssl:tea:1666

Set P4PORT as above, but for all users on the system.

You must have administrative privileges to do this.

p4 set -S p4svc P4PORT=1666

For the Windows service p4svc, instruct p4s.exe to listen on port 1666 for incoming connections from Helix server applications.

You must have administrative privileges to do this.

p4 set -S Perforce P4DEBUG="net.keepalive.idle=2700"

For the Windows service, which defaults to the name Perforce, instruct p4s.exe to wait 2700 seconds before starting to send keepalives.

You must have administrative privileges to do this.

p4 set P4EDITOR="C:\File Editor\editor.exe"

On Windows, for the current local user, set the path for the default text editor.

The presence of spaces in the path to the editor’s executable requires that the path be enclosed in quotation marks.