p4 set

Synopsis

Set Perforce variables in the Windows registry or OS X system settings.

Syntax

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

Description

Both Perforce applications and the shared versioning service make use of certain system variables.

On Windows (or OS X), you can set the values of these variables in the registry (or user or system preferences) with p4 set; on other operating systems, Perforce uses environment variables for the same purpose.

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.

Windows administrators running Perforce as a service can set variables used by the service (for instance, P4JOURNAL and others) with p4 set -S svcname var=value.

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

To view a list of the values of all Perforce 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 or OS X, this displays either the environment variable (if set), or the value in the registry (or system settings) and whether it was defined with p4 set (for the current user) or p4 set -s (for the local machine).

p4 set can be used on Linux and UNIX to view the values of variables, but if you try to use p4 set to set variables on these operating systems, Perforce displays an error message.

Options

-s

Set the value of the registry variable (or system settings) 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.

On OS X, without this option, p4 set sets the variables in your com.perforce.environment property list in the ~/Library/Preferences folder; when you use the -s option (and have administrative privileges), the variables are set in the system /Library/Preferences folder.

These locations are reflected in the output of p4 set on Windows and OS X.

-S svcname

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

The -S option is ignored on OS X.

g-opts

See the “Global Options” section.

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 Perforce 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 Perforce Windows service must be present at the machine running the service.

  • On Windows or OS X, variables have the following precedence:

    • Environment variables with the same names have precedence;

    • Values within P4CONFIG files have precedence over both of these;

    • For the Perforce service, configurables set with p4 configure override all environment variables, including registry entries set with p4 set -S;

    • The “Global Options”, specified on the command line, have the highest 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 Perforce Command-Line Client behaves just as though it were in a UNIX environment.)

Examples

p4 set

On all platforms, display a list of Perforce variables 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 or OS X, set a variable telling Perforce 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 Perforce applications.

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.