2

So I have installed the Team Foundation Server PowerShell Tools, and verified they exist, but the executables (TFPT.exe) do not appear to be available in powershell.

Looking at $env:path (and looking at the path variable through System Properties) I see that the end of the path variable looks like this: $env:Path = {other variables};%TFSPowerToolDir%;%BPADir%;.; System Properties Enviromental Variables = {other variables};%TFSPowerToolDir%;%BPADir%

When I look at $env:TFSPowerToolDir I get C:\Program Files (x86)\Microsoft Team Foundation Server 2013 Power Tools\, so that seems correct.

But if I try to run tfpt I get the error "The term 'tfpt.exe' is not recognixed as the name of a cmdlet...

If I first do cd $env:TFSPowerToolDir and the run tfpt it works fine. So the environmental variable is correct. But it doesn't seem to get placed in the path.

Any ideas on how to fish this?

1 Answer 1

3

Can't replicate the problem here, actually. The problem seems to be that other environment variables are not expanded in $Env:PATH here, but in a quick test PowerShell did so for me reliably.

You could try to work around the problem by manually expanding environment variables in your profile script. E.g. with something like the following:

$Env:PATH = [regex]::Replace($Env:PATH, '%([^%]+)%', {
  param($m)
  $n = $m.Groups[1].Value
  Get-Content -Raw Env:\$n
})
Sign up to request clarification or add additional context in comments.

1 Comment

That does indeed solve the problem, thank you. So it sounds like my system is acting incorrectly. So that's a good temporary fix and gives me some more information as to what the problem is. Thanks again!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.