1

I've come to notice, that long multi line commands are not logged to the ConsoleHost_history.txt in PowerShell 7 (unlike in PowerShell 5). How can I change this?

1 Answer 1

1

While the AddToHistoryHandler of Get-PSReadLineOption is $null in PowerShell 5, in PowerShell 7 it isn't.

Executing the following removes the handler and long multi line commands are logged as well:

Set-PSReadLineOption -AddToHistoryHandler $null

To make this change permanent, add the line above to your PowerShell 7 profile. The location of the profile file is stored in the automatic variable $PROFILE (you might need to create the file).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .