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?
Asked
Active
Viewed 253 times
1
FatalBulletHit
- 385
1 Answers
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).
FatalBulletHit
- 385