powershell - save and reload directory history -


I would like to save the last $ cnt entries of the PowerHell of Get-Thru-Stack , And then reloads history when PowerShell starts.
This does not work:

  Register-EngineEvent PowerShell.Exiting {gate-space-stack | Choose - last 5 Export-CliXml $ HistoryPath -Encoding UTF8} -SupportEvent  

Despite running "Get-Location-Stack" on the command line, many entries are displayed. There is no entry in .xml.
If I gain history and run piping through the Export-CliXml cmdlet during PowerShell session, then it works as expected.
Just like, exporting command history works as expected.
Am I trying to export export directory history?

Check to see if you have ever used a $ HistoryPath valid Started in the path.


Comments