You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Existing Issue: Search the existing issues for this repository. If there is an issue that fits your needs do not file a new one. Subscribe, react, or comment on that issue instead.
Descriptive Title: Write the title for this issue as a short synopsis. If possible, provide context. For example, "Document new Get-Foo cmdlet" instead of "New cmdlet."
PowerShell Version
7.3
Summary
The script example in the help topic for $PSNativeCommandUseErrorActionPreference could be simplified to use a scriptblock to reset the variable's value when the scope exits.
Prerequisites
Get-Foo
cmdlet" instead of "New cmdlet."PowerShell Version
7.3
Summary
The script example in the help topic for
$PSNativeCommandUseErrorActionPreference
could be simplified to use a scriptblock to reset the variable's value when the scope exits.Related to PowerShell issue: PowerShell/PowerShell#20034
Details
The following example is given in the current docs:
This works but I think the use of a scriptblock would clean this up a bit:
This will automatically reset the value of
$PSNativeCommandUseErrorActionPreference
after the scriptblock exits.Proposed Content Type
About Topic
Proposed Title
N/A
Related Articles
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#psnativecommanduseerroractionpreference
The text was updated successfully, but these errors were encountered: