簡體   English   中英

無法刪除某些Powershell命令

[英]Can't remove some powershell commands

我以為我會在另一個問題中解決這個問題,但是我似乎無法禁用Reset-BC命令。

通常我會用

Remove-Item -force alias:Reset-BC

但是我只是得到以下錯誤

Remove-Item : Cannot find path 'Alias:\Reset-BC' because it does not exist.
At line:1 char:1
+ Remove-Item -force alias:\Reset-BC
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Alias:\Reset-BC:String) [Remove-Item], ItemNot
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand

誰能解釋這個或告訴我如何擺脫它?

絕對讓我最討厭Powershell的事情-它只會在您的道路上堆滿垃圾。 有時它實際上還會隱藏適當的應用程序,例如where和sc及其東西,這甚至更糟。 我會使用cmd但缺少自動完成功能會很痛苦:(

您可以測試Cmdlet的存在性:

If(get-item alias:Reset-BC) {Remove-Item -force alias:Reset-BC} else {'not exist'}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM