打算从此启动vim
PS C:\temp> get-command vim | select name,source
Name Source
---- ------
vim.bat C:\Users\noam\AppData\Local\Microsoft\WindowsApps\vim.bat
我不小心进入了vm
而不是,随之vim
而来的是很多令人头疼的事情:
C:\temp>pwsh -noprofile
PowerShell 7.4.1
PS C:\temp> vm
Get-VM: 29-Mar-24 16:28:14 Get-VM You are not currently connected to any servers. Please connect first using a Connect cmdlet.
PS C:\temp> get-command vm
Get-Command: The term 'vm' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
PS C:\temp> get-alias vm
Get-Alias: This command cannot find a matching alias because an alias with the name 'vm' does not exist.
PS C:\temp> cmd /c where vm
INFO: Could not find files for the given pattern(s).
如何查找并删除看似从 VMware PowerCLI映射vm
到的配置?Get-VM
PS C:\temp> get-command get-vm | select Name,Source
Name Source
---- ------
Get-VM VMware.VimAutomation.Core
我一定是错过了一些愚蠢的事情。我本以为上面的调用where.exe
应该发现了与我的路径相关的任何内容。无论如何,设置后行为不会改变$env:PATH = $null
。
作为一个拼凑,我可以明确地重新定义vm
viaSet-Alias
到一些不存在的命令。但我想了解为什么在执行时看不到类似下面的内容vm
。我忽略了什么?
PS C:\temp> doesnotexist
doesnotexist: The term 'doesnotexist' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
无论是否VMware.VimAutomation.Core
显式导入模块,上述结果都可以重现。