我今天试着使用psreadline。有件事我不明白,就是历史指令。
当我跑的时候
Set-PSReadLineOption -PredictionSource 历史建议开始出现。
我关闭终端ps,再次打开它,在我再次运行命令之前,没有历史提示。
我错过了什么?
发布于 2021-06-05 03:27:49
如果这是你使用的唯一命令..。
Set-PSReadLineOption -PredictionSource。。那就不完整了。
根据下面的Powershell文档:Ms.Docs= PSReadLine
-PredictionSource
Specifies the source for PSReadLine to get predictive suggestions.
Valid values are:
None: disable the predictive suggestion feature
History: get predictive suggestions from history only所以你必须告诉它你想要什么
Set-PSReadLineOption -PredictionSource History或
Set-PSReadLineOption -PredictionSource None后者是默认的,如果你不告诉它的话。只需将前者放在所有控制台配置文件中即可。
Get-PSReadLineOption
<#
EditMode : Windows
AddToHistoryHandler : System.Func`2[System.String,System.Object]
HistoryNoDuplicates : True
HistorySavePath : C:\Users\WDAGUtilityAccount\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt
...
PredictionSource : None
...
#>一定要读懂..。
Set-PSReadLineOption -HistorySaveStyle..。以及它的选择。
https://stackoverflow.com/questions/67844259
复制相似问题