p4 set
View or set P4 variables used by P4 Servers and client applications.
Syntax
p4 [g-opts] set [-q] [-s | -S svcname] [var[=[value]] ...]
Description
View or set P4 variables, which are used by P4 Server, P4 Proxy, P4 client applications (such as P4 CLI and P4 Visual Client (P4V)), and plugins (such as P4 for Eclipse and P4 for Visual Studio).
To view a list of variables, | To set the value of a variable, |
---|---|
with the value and the source of each variable, run the p4 set command or the p4 set -S service-name command. The values that display are in effect for subsequent commands and when starting a P4 Windows service. |
specify the variable and the value. For example, p4 set P4EDITOR="C:\Program Files\Notepad++\notepad++.exe" |
Depending on the operating system and other factors,
variable definitions can 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 theP4ENVIRO
file. -
On Windows, values defined with
p4 set
are stored in theP4ENVIRO
file, if this is set. If it is not set, they are stored in the Windows registry.-
Windows administrators running P4 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. -
Windows administrators can use
p4 set -s var=value
to set the variable’s default values for all users on the machine.
-
To change a variable setting that applies to the current user, use
|
To set multiple variables in a single command, use a blank space as a separator:
|
Precedence for variables
- On the command line, using options.
- In the configuration file(s) specified by a P4CONFIG environment variable, where each config file can be specific to a workspace.
- In the P4ENVIRO configuration file, which is for variables that remain constant for all the workspaces on a given computer.
- User environment variables.
- System environment variables (on Windows, system-wide environment variables are not necessarily the same as user environment variables)
- In the user registry or settings set by issuing
the
p4 set
command. - In the system registry or system settings set by
issuing the
p4 set -s
command.
where
Unsetting variable values
To unset the value for a particular variable, leave its
value
empty.
Viewing variable values and the source of the definition
To view the list of values for a P4 client, run p4 set
without any arguments.
To view values for variables that affect a P4 Windows service, run p4 set -S service-name
- On Linux, 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) orp4 set -s
(for the local machine).
The output to the p4 set
command shows the source of the variable definition. For example,
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)
If a P4CONFIG
file was used to set the
variable, its location is displayed.
If no source is displayed, the value is stored in the variable itself rather than in a file containing the definition.
Options
|
Reduce the output. When listing files, don’t display the source of the definition. The output is suitable for parsing with scripts. |
|
Set the value of the registry variable for the local machine. On Windows, without this option, The location is reflected in the output of Requires Windows administrator privileges. |
|
Set the value of the registry variables as used by service
Requires Windows administrator privileges. |
|
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 |
Requires Windows administrator
privileges for |
- Changes to registry settings under Windows affect the local machine
only. An administrator setting
P4JOURNAL
for a P4 Server Windows service must be present at the machine running the service. - If you’re working in a Linux-like environment on a Windows machine, for example, Cygwin, use environment variables instead of
p4 set
. - For a description of all the P4 Server variables, see Environment and registry variables, which also lists the server variables that are reserved for the P4 administrator.
Examples
|
On all platforms, display a list of each P4 Server variable and its source without changing their values. |
|
On all platforms, display a list of P4 Server variables in a format suitable for scripts to parse without changing their values. |
|
On Windows or macOS, unset the value of |
|
On Windows, set a variable that specifies that P4 Server
applications are to connect to a
P4 service at host host1, port The variable is set only for the current local user. |
|
Set You must have administrative privileges to do this. |
p4 set P4CONFIG=.p4config.txt
|
Set the P4CONFIG environment variable to use the specified file. For more information, see P4CONFIG. |
|
For the Windows service 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 You must have administrative privileges to do this. |
|
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. |