How to get perforce root directory from command line?

How to get perforce root directory from command line? I tried p4 info , but I would prefer not to filter it to gain access to the root. I am sure there is a way, but I could not find it.

Is there a way to get the root in a context sensitive context? For example, if I have two workspaces with a hierarchy such as A /.../ script vs B /.../ script, I would expect the script to return either A or B depending on where it was run it.

+7
perforce
source share
2 answers

If you want your root user to be executed in one command:

 p4 -F %clientRoot% -ztag info 

To use this flag, you will need a later version of p4 2014.1.

+6
source share

For older versions prior to 2014.1 use the command

p4 info | grep 'Client root:' | cut -d '' -f 3 -

0
source share

All Articles