perforceperforce-workspace

P4 - change workspace for client


I want to change the workspace client using the p4 command line but i don't know if its possible. You can create, delete or edit workspace using the p4 workspace command, but i want to change the current workspace with a .bat method.

Example:

p4 -c MyClient changeworkspace myNewWorkspace

If you know in first step if it's possible.


Solution

  • Either set the P4CLIENT environment variable to the name of the workspace you want to be your current workspace, or consistently pass that workspace name as the value of the -c flag on your p4 commands: http://www.perforce.com/perforce/doc.current/manuals/cmdref/env.P4CLIENT.html#1040647

    See also these other ways to set the environment variable (many people find P4CONFIG files helpful): http://www.perforce.com/perforce/doc.current/manuals/p4guide/02_config.html#1069873