在 Windows 上,PowerShell 的历史记录通常会保存在用户目录下的 ConsoleHost_history.txt 文件中(位于 C:\Users\用户名\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline)。
你可以删除这个文件来清除历史记录:
Remove-Item -Path "$env:APPDATA\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt"