14

tf : The term 'tf' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

I set up the environment variable but does not work. tf command works in Developer Command Prompt for VS2013 but does not work in Powershell. How can I make this to work?

Edit System Variable dialog

crusy
  • 1,424
  • 2
  • 25
  • 54
Ninja
  • 347
  • 3
  • 5
  • 14
  • Which environment variable did you set? You can just find tf.exe and call it using its full path. Also, you don't show us any code... – Martin Brandl Oct 28 '15 at 23:34

4 Answers4

12

You need to include tf.exe full path. For example, you want to check in files with tf checkin command in PowerShell:

$filePath = "C:\Users\username\Source\Workspaces\teamproject\solutionname\projectname\Class1.cs"  
Set-Alias tfs "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\tf.exe"  
tfs checkin $filePath   /noprompt
Vicky - MSFT
  • 4,970
  • 1
  • 14
  • 22
  • 6
    TF.exe might also be located here: "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer" – MBWise Feb 13 '18 at 14:31
  • 2
    And if it's not, you can always go to your drive root and use: `dir tf.exe /S` -- mine is now in _c:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer_ – ruffin Aug 19 '20 at 15:27
9

This worked for me. I added the path of TF.exe ("C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE" in my case) to system environment PATH variable (through My Computer->Properties->Advanced System Settings->Environment Variables->System Variables->Path->Edit).

You can check if "tf" is working by typing "tf" in the powershell. If you get an output something as : Microsoft (R) TF - Team Foundation Version Control Tool, Version 14.102.25619.0 Copyright (c) Microsoft Corporation. All rights reserved. ......

tf is working properly.

Himanshu Tanwar
  • 378
  • 2
  • 18
0

To answer the question form another perspective, this is how you are supposed to call the tf environment variable you created:

%tf%

I've given it the value C:\Windows\notepad.exe, and the application opens when calling the variable from cmd.

sodawillow
  • 12,497
  • 4
  • 34
  • 44
0

You need to download and install the Microsoft Team Foundation Server Power Tools in order to run the TFPT command. TFS 2015 version can be found here: Microsoft Team Foundation Server 2015 Power Tools

If you run the Powershell from VS Tools then you need to close your Powershell session and restart your VS in order for it to pick up the newly installed tools and run the Powershell again.

Blue Bamboo
  • 147
  • 3
  • 13