背景:
现在我有了一种跨会话保存历史记录的方法,因此PowerShell的历史记录对我来说更加有用了。
# Run this every time right before you exit PowerShell
get-history -Count $MaximumHistoryCount | export-clixml $IniFileCmdHistory;
现在,我正在尝试防止PowerShell将重复的命令保存到我的历史记录中。
我尝试使用Get-Unique
,但这并不起作用,因为历史记录中的每个命令都是“唯一”的,因为每个命令都有一个不同的ID号码。
Set-PSReadlineOption -HistoryNoDuplicates
,但它似乎对我无效。 - imgx64