2017-04-09 37 views

回答

5

似乎PowerShell有一个名为Select-String的命令/ cmdlet,它具有sls的别名。 PowerShell alias sls似乎优先于sls的node.js无服务器命令。删除PowerShell的SLS别名

一种方式是通过在PowerShell中

Remove-Item alias:sls 

这种改变运行以下内容仅适用于当前的PowerShell会话。

要永久保存sls PowerShell别名,您可以更改Microsoft.PowerShell_profile.ps1文件。

从PowerShell中在记事本中打开您的个人资料页面使用下面的命令:

notepad $profile 

以下内容添加到该文件并保存。

remove-item alias:sls 

轮廓可以通过运行重新加载从Powershell的

. $profile 

以下在我的文件,你会看到,我已删除卷曲和SLS的别名。

Change PowerShell Profile

现在我明白我期待在PowerShell中进入SLS时。 enter image description here

How do I permanently remove a default Powershell alias?

---更新----

一个更简单的选择是使用命令 “无服务器”,而不是 “SLS”。

+1

为了将来的参考,[当powershell试图解析不合格的命令名时,别名* always *优先](https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.core/ about/about_command_precedence) –

+0

@Mathias - 感谢您的链接。知道关于命令的优先级是很好的。 –