Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set-PSReadlineOption -MaximumHistoryCount ignored in profile #1781

Closed
jdhitsolutions opened this issue Aug 30, 2017 · 3 comments · Fixed by #1869
Closed

Set-PSReadlineOption -MaximumHistoryCount ignored in profile #1781

jdhitsolutions opened this issue Aug 30, 2017 · 3 comments · Fixed by #1869
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation.

Comments

@jdhitsolutions
Copy link

Steps to reproduce

Open a PowerShell console and run

Set-PSReadlineOption -MaximumHistoryCount 512

Get-PSReadlineOption confirms the change.

Expected behavior

We should be able to set the maximum history count with Set-PSReadlineOption in a profile script.

Actual behavior

But when you put the same command in a PowerShell profile script, the parameter is ignored. Although if you set something like -HistoryNoDuplicates or -HistorySearchCaseSensitive those settings will be configured through the profile script. Get-PSReadlineOption shows the default value for MaximumHistoryCount.

Environment data

Name                           Value                                                                                   
----                           -----                                                                                   
PSVersion                      5.1.16275.1000                                                                          
PSEdition                      Desktop                                                                                 
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                 
BuildVersion                   10.0.16275.1000                                                                         
CLRVersion                     4.0.30319.42000                                                                         
WSManStackVersion              3.0                                                                                     
PSRemotingProtocolVersion      2.3                                                                                     
SerializationVersion           1.1.0.1                                                                                 

I get similar results in beta-6 on Linux.

@jdhitsolutions
Copy link
Author

After a quick exchange with @lzybkr it appears that the built-in PowerShell variable $MaximumHistoryCount over rides any setting you make with Set-PSReadLineOption. If I set $MaximumHistoryCount in my profile, that is the value that PSReadline uses. So I guess this isn't a bug. BUT since this feature is ignored, it should be deprecated or at least have the documentation updated.

@SteveL-MSFT

This comment has been minimized.

@daxian-dbw daxian-dbw transferred this issue from PowerShell/PowerShell Aug 28, 2020
@ghost ghost added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Aug 28, 2020
@daxian-dbw daxian-dbw reopened this Aug 28, 2020
@daxian-dbw daxian-dbw added Issue-Docs It's a documentation issue. and removed Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. labels Aug 28, 2020
@daxian-dbw daxian-dbw added Issue-Bug It either shouldn't be doing this or needs an investigation. and removed Issue-Docs It's a documentation issue. labels Oct 9, 2020
@daxian-dbw
Copy link
Member

This is actually a bug. Run Set-PSReadlineOption -MaximumHistoryCount from user's profile should work as rest of the settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants