This can be done by adding a file \Saved\Config\Windows\SourceControlSettings.ini with content like this:
[SourceControl.SourceControlSettings]
Provider=Perforce
[PerforceSourceControl.PerforceSourceControlSettings]
Port=<server_address:port>
UserName=<usename>
Workspace=<workspace>