Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

C/C++ API Documentation | 2026.1

# ClientApi::SetCwd( const StrPtr * )

Sets the working directory to be used for this connection.

Virtual? | No |
Class | `ClientApi` |
Arguments | `const StrPtr *c` | the new directory path
Returns | `void` |

## Notes

`SetCwd()` does not permanently set a new working directory in the client environment. The new setting applies only to commands executed by calling this `ClientApi` object’s `Run()` method.

## Example

The following code sets different working directories and displays them with `p4 info`.

    ClientApi client;
    ClientUser ui;
    StrBuf sb1;
    StrBuf sb2;

    sb1 = "C:\one";
    sb2 = "C:\two";

    client.SetCwd( &sb1 );
    client.Run( "info", &ui );

    client.SetCwd( &sb2 );
    client.Run( "info", &ui );

Your search for returned results