2017-04-09 38 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 - 感謝您的鏈接。知道關於命令的優先級是很好的。 –