删除启动时的 Powershell 错误

Remove Powershell error on startup

我尝试安装 Posh-Git 以将 ssh 与 Powershell 一起使用。

我按照说明操作了here

这里的文件没有数字签名所以我更改了执行策略来安装它。然后我(出于某种原因)决定不使用它,所以我删除了文件。

现在,每当我启动 Powershell 时,都会收到类似于以下内容的错误消息:

The term 'C:\xxx\xxx\profile.example.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program.

如何阻止每次启动 Powershell 时出现此错误消息?

您需要编辑您的 PowerShell 配置文件并从那里删除该行。最简单的方法是(从您的 PowerShell 中):

notepad $profile

或者您可以使用 $profile 查找您的个人资料并在那里编辑文件。

进一步阅读请查阅:https://blogs.technet.microsoft.com/heyscriptingguy/2012/05/21/understanding-the-six-powershell-profiles/