Environment Variables


Overview

This table lists all the Perforce environment variables and their definitions.

You'll find a full description of each variable in the Perforce Command Reference.

Variable Definition
P4CLIENT Name of current client workspace
P4CONFIG File name from which values for current environment variables are to be read
P4DIFF The name and location of the diff program used by p4 resolve and p4 diff
P4EDITOR The editor invoked by those Perforce commands that use forms
P4HOST Name of host computer to impersonate. Only used if the Host: field of the current client workspace has been set in the p4 client form.
P4JOURNAL A file that holds the database journal data
P4LOG Name and path of the file to write Perforce errors to
P4MERGE A third-party merge program to be used by p4 resolve's merge option
P4PAGER The program used to page output from p4 resolve's diff option
P4PASSWD Stores the user's password as set in the p4 user form
P4PORT For the Perforce server, the port number to listen on; for the p4 client, the name and port number of the Perforce server with which to communicate
PWD The directory used to resolve relative filename arguments to p4 commands
P4ROOT Directory in which p4d stores its files and subdirectories
P4USER The user's Perforce username
TMP The directory to which Perforce writes its temporary files

Setting and viewing environment variables

Each operating system and shell has its own syntax for setting environment variables. The following table shows how to set the P4CLIENT environment variable in each OS and shell:

OS or Shell Environment Variable Example
UNIX: ksh, sh, bash P4CLIENT=value ; export P4CLIENT
UNIX: csh setenv P4CLIENT value
VMS def/j P4CLIENT "value"
Mac MPW set -e P4CLIENT value
Windows p4 set P4CLIENT=value

Windows administrators running Perforce as a service can set variables for use by a specific service with p4 set -S svcname var=value.

To view a list of the values of all Perforce variables, use p4 set without any arguments.

On UNIX, this displays the values of the associated environment variables. On NT, this displays either the MS-DOS 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).

 

Home