獲取 PowerShell 命令歷史文件位置:
(Get-PSReadlineOption).HistorySavePath
顯示 PowerShell 命令歷史文件的內容:
cat (Get-PSReadlineOption).HistorySavePath
通過刪除歷史文件清除 PowerShell 中的命令歷史記錄:
Remove-Item (Get-PSReadlineOption).HistorySavePath
更改 PowerShell 命令歷史記錄的保存方式:
預設保存輸入紀錄於檔案
Set-PSReadlineOption -HistorySaveStyle SaveIncrementally # default
在單次使用時於離開終端時保存記錄
Set-PSReadlineOption -HistorySaveStyle SaveAtExit
不保存任何輸入紀錄
Set-PSReadlineOption -HistorySaveStyle SaveNothing
發佈留言
很抱歉,必須登入網站才能發佈留言。