首页 文章

powershell tf命令未被识别为cmlet的名称

提问于
浏览
7

tf:术语“tf”未被识别为cmdlet,函数,脚本文件或可操作程序的名称 . 检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试 .

我设置了环境变量但不起作用 . tf命令在VS2013的Developer Command Prompt中有效,但在Powershell中不起作用 . 我怎样才能使这个工作? enter image description here

2 回答

  • 3

    您需要包含tf.exe完整路径 . 例如,您想在PowerShell中使用tf checkin命令检入文件:

    $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
    
  • 7

    这对我有用 . 我将TF.exe的路径(在我的情况下为"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE")添加到 system environment PATH variable (通过我的电脑 - >属性 - >高级系统设置 - >环境变量 - >系统变量 - >路径 - >编辑) .

    您可以通过在powershell中键入“tf”来检查“tf”是否正常工作 . 如果您得到的输出为:Microsoft(R)TF - Team Foundation版本控制工具,版本14.102.25619.0版权所有(c)Microsoft Corporation . 版权所有 . ......

    tf工作正常 .

相关问题