我最近安装了 Windows 10,其中包括 PowerShell V5,或者5.1.14393.206
确切地说是 ( $PSVersionTable.PSVersion
)。
在新计算机上我安装PSReadline。但是,Windows 10 已经安装了它。
我的问题是,当没有配置文件可以导入时,PSReadline 如何自动加载(或从中调用命令)?
作为证明,我运行了以下代码:
$PROFILE | Get-Member -MemberType NoteProperty | % {
$path = $PROFILE.$($_.Name);
$exists = Test-Path $path;
[pscustomobject]@{ Path = $path; Exists = $exists }
}
要得到这个:
Path Exists
---- ------
C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1 False
C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShell_profile.ps1 False
C:\Users\tahir\Documents\WindowsPowerShell\profile.ps1 False
C:\Users\tahir\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 False
我已经浏览了所有https://stackoverflow.com/a/23942543/288393:
- 没有调用
Import-Module
PSReadline,因为没有配置文件可以调用它。 - PSReadline 模块中没有命令,因为和以前一样,没有配置文件可以调用它。
有人可以解释这种行为吗?