Global options for Perforce commands; these options may be supplied on the command line before any Perforce command.
p4 [ -c client -d dir -p port -u user -P pass -x file -s ] cmd [ arg ... ]
-c client | Overrides any P4CLIENT setting with the specified client name |
-d dir | Overrides any PWD setting (i.e. current working directory) and replaces it with the specified directory |
-p port | Overrides any P4PORT setting with the specified port number |
-u user | Overrides any P4USER, USER, or USERNAME setting with the specified user name |
-P pass | Overrides any P4PASSWD setting with the specified password |
-x file | Instructs Perforce to read arguments, one per line, from the specified file. If file is a single hyphen (-), then standard input will be read. |
-s | Prepends a descriptive field (e.g. text:, info:, error:, exit:) to each line of output produced by a Perforce command. |
p4 -p new_server:1234 sync | Performs a sync using server new_server and port 1234, regardless of the settings of the P4PORT environment variable or registry setting. |
p4 -c new_client submit -c 100 | The first -c is the global option to specify the client name. The second -c specifies a changelist number. |
p4 -s -x filelist.txt submit | If filelist.txt contains a list of files, this command will open each file on the list for editing, and produce output suitable for parsing by scripts. Any errors as a result of the automated p4 edit commands (e.g. a file in filelist.txt not being found) could then be easily detected. |