首先查找Powershell历史记录存放位置。打开powershell,执行:
PS C:\Windows\System32> Get-PSReadLineOption
可以看到Powershell历史纪录的存储位置为:
HistorySavePath : C:\Users\xxxxx\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleH
ost_history.txt
转到该目录下,文件 ConsoleHost_history.txt 就是所有Powershell命令行历史记录了。可进行编辑修改或删除。