有没有windows shell工具可以保留历史? [英] Is there a windows shell tool can keep history?
问题描述
我使用windows 7 64位。我发现cmd.exe和powershell不能保留历史记录。这意味着当我退出shell时,它丢失了我的命令历史。
I use windows 7 64bit. I found both cmd.exe and powershell cannot keep history. It means it lost my command history when I quit the shell.
有没有工具可以帮助cmd.exe或powershell记住历史记录?我尝试使用控制台2.控制台2是微小的,并有一个选项卡界面。但控制台2不记得历史了。也许还有另一个前端可以做到这一点。
Is there a tools can help cmd.exe or powershell to remember the history? I try to use console 2. Console 2 is tiny and has a tab interface. But console 2 can't remember the history too. Maybe there is another front end can do this.
推荐答案
下面的答案是从Keith Hill问题 powershell历史记录:如何防止重复命令 :
The answer below is from Keith Hill (PowerShell Microsoft MVP) in his answer to the question powershell history: how do you prevent duplicate commands:
BTW如果你想在退出时自动保存,你可以这样在2.0上这样:
BTW if you want to automatically save this on exit you can do this on 2.0 like so:
Register-EngineEvent PowerShell.Exiting {
Get-History -Count 32767 | Group CommandLine |
Foreach {$_.Group[0]} | Export-CliXml "$home\pshist.xml" } -SupportEvent
您需要的是:
Import-CliXml "$home\pshist.xml" | Add-History
这篇关于有没有windows shell工具可以保留历史?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!