Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Summary: The Perforce command line p4 does not work correctly unless I open the shell from P4V. How/where do I edit things to fix my configuration so that it always works?

Details

On Windows 7x64, if I run cmd.exe and then use the p4 command line it attempts to connect to an old server that no longer exists:

C:\>p4 info
Perforce client error:
        Connect to server failed; check $P4PORT.
        TCP connect to p4proxy-bdr:2006 failed.
        connect: p4proxy-bdr:2006: WSAETIMEDOUT

C:\>echo %P4PORT%
%P4PORT%

However, if I launch P4V (which is connecting to the correct server), right-click on any file in my Workspace and choose "Open Command Window Here", the same commands work correctly:

C:\>p4 info
User name: gkistner
Client name: gkistner-dt2
Client host: gkistner-dt2
Client root: C:/p4/p4sw
Current directory: c:\
Peer address: <redacted>
Client address: <redacted>
Server address: <redacted>
Server root: <redacted>
Server date: 2013/08/13 10:05:09 -0700 PDT
Server uptime: 1512:04:23
Server version: <redacted>
Server license: <redacted>
Server license-ip: <redacted>
Case Handling: sensitive

C:\>echo %P4PORT%
p4sw:2006

Where is P4 getting the configuration when I launch it from a vanilla cmd.exe, and how do I change that to be the same as what P4V sets up?

share|improve this question
    
Related: stackoverflow.com/q/9885053/405017 –  Phrogz Aug 13 '13 at 18:01

1 Answer 1

P4's command line settings can be set by using the p4 set command. With no arguments, under the working shell, this lists the current values:

C:\>p4 set
P4CLIENT=gkistner-dt2
P4EDITOR=C:\Windows\SysWOW64\notepad.exe (set)
P4PASSWD=<redacted> (set)
P4PORT=p4sw:2006
P4USER=gkistner

Then, go to the non-working shell and copy/paste each of these, prefixed with p4 set:

C:\>p4 set P4CLIENT=gkistner-dt2
C:\>p4 set P4EDITOR=C:\Windows\SysWOW64\notepad.exe
C:\>p4 set P4PASSWD=<redacted>
C:\>p4 set P4PORT=p4sw:2006
C:\>p4 set P4USER=gkistner

Now you can close this shell and open any new one, and P4 will work.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.