diff --git a/reference/7.3/Microsoft.PowerShell.Core/About/about_Preference_Variables.md b/reference/7.3/Microsoft.PowerShell.Core/About/about_Preference_Variables.md index 43a9f0d3b7c3..498782c5fd7c 100644 --- a/reference/7.3/Microsoft.PowerShell.Core/About/about_Preference_Variables.md +++ b/reference/7.3/Microsoft.PowerShell.Core/About/about_Preference_Variables.md @@ -1,7 +1,7 @@ --- description: Variables that customize the behavior of PowerShell. Locale: en-US -ms.date: 09/29/2023 +ms.date: 11/30/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Preference Variables @@ -1065,16 +1065,20 @@ information other than errors. In these cases, you can temporarily disable the behavior and prevent non-zero exit codes from issuing errors. ```powershell -$definedPreference = $PSNativeCommandUseErrorActionPreference -$PSNativeCommandUseErrorActionPreference = $false -robocopy.exe D:\reports\operational "\\reporting\ops" CY2022Q4.md -$robocopyExitCode = $LASTEXITCODE -if ($robocopyExitCode -gt 8) { - throw "robocopy failed with exit code $robocopyExitCode" +& { + # Disable $PSNativeCommandUseErrorActionPreference for this scriptblock + $PSNativeCommandUseErrorActionPreference = $false + robocopy.exe D:\reports\operational "\\reporting\ops" CY2022Q4.md + if ($LASTEXITCODE -gt 8) { + throw "robocopy failed with exit code $LASTEXITCODE" + } } -$PSNativeCommandUseErrorActionPreference = $definedPreference ``` +In this example, the `$PSNativeCommandUseErrorActionPreference` variable is +changed inside a scriptblock. The change is local to the scriptblock. When the +scriptblock exits, the variable reverts to its previous value. + ## $PSSessionApplicationName Specifies the default application name for a remote command that uses Web diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Preference_Variables.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Preference_Variables.md index 9f8bc97a7e6c..00ae7e8b1117 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Preference_Variables.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Preference_Variables.md @@ -1057,16 +1057,20 @@ information other than errors. In these cases, you can temporarily disable the behavior and prevent non-zero exit codes from issuing errors. ```powershell -$definedPreference = $PSNativeCommandUseErrorActionPreference -$PSNativeCommandUseErrorActionPreference = $false -robocopy.exe D:\reports\operational "\\reporting\ops" CY2022Q4.md -$robocopyExitCode = $LASTEXITCODE -if ($robocopyExitCode -gt 8) { - throw "robocopy failed with exit code $robocopyExitCode" +& { + # Disable $PSNativeCommandUseErrorActionPreference for this scriptblock + $PSNativeCommandUseErrorActionPreference = $false + robocopy.exe D:\reports\operational "\\reporting\ops" CY2022Q4.md + if ($LASTEXITCODE -gt 8) { + throw "robocopy failed with exit code $LASTEXITCODE" + } } -$PSNativeCommandUseErrorActionPreference = $definedPreference ``` +In this example, the `$PSNativeCommandUseErrorActionPreference` variable is +changed inside a scriptblock. The change is local to the scriptblock. When the +scriptblock exits, the variable reverts to its previous value. + ## $PSSessionApplicationName Specifies the default application name for a remote command that uses Web diff --git a/reference/docs-conceptual/learn/experimental-features.md b/reference/docs-conceptual/learn/experimental-features.md index 31846a644d07..c039c11cd763 100644 --- a/reference/docs-conceptual/learn/experimental-features.md +++ b/reference/docs-conceptual/learn/experimental-features.md @@ -107,17 +107,14 @@ Legend The ANSI formatting features were added in PowerShell 7.2. This feature adds the `$PSStyle.FileInfo` member and enables coloring of specific file types. -- `$PSStyle.FileInfo.Directory` - Built-in member to specify color for directories -- `$PSStyle.FileInfo.SymbolicLink` - Built-in member to specify color for symbolic links -- `$PSStyle.FileInfo.Executable` - Built-in member to specify color for executables. -- `$PSStyle.FileInfo.Extension` - Use this member to define colors for different file extensions. - The **Extension** member pre-includes extensions for archive and PowerShell files. +- `$PSStyle.FileInfo.Directory` - Built-in member to specify the color for directories +- `$PSStyle.FileInfo.SymbolicLink` - Built-in member to specify the color for symbolic links +- `$PSStyle.FileInfo.Executable` - Built-in member to specify the color for executables. +- `$PSStyle.FileInfo.Extension` - Use this member to define the colors for different file + extensions. The **Extension** member pre-includes extensions for archive and PowerShell files. For more information, see [about_Automatic_Variables][05]. -> [!NOTE] -> This feature is dependent on the **PSAnsiRendering** feature that's now a standard feature. - ### PSCommandNotFoundSuggestion Recommends potential commands based on fuzzy matching search after a **CommandNotFoundException**. diff --git a/reference/docs-conceptual/toc.yml b/reference/docs-conceptual/toc.yml index 11171a90d976..cd91f6dd28c0 100644 --- a/reference/docs-conceptual/toc.yml +++ b/reference/docs-conceptual/toc.yml @@ -247,14 +247,12 @@ items: items: - name: Overview href: whats-new/overview.yml - - name: What's new in PowerShell 7.x - items: - - name: What's new in PowerShell 7.4 - href: whats-new/what-s-new-in-powershell-74.md - - name: What's new in PowerShell 7.3 - href: whats-new/what-s-new-in-powershell-73.md - - name: What's new in PowerShell 7.2 - href: whats-new/what-s-new-in-powershell-72.md + - name: What's new in PowerShell 7.4 + href: whats-new/what-s-new-in-powershell-74.md + - name: What's new in PowerShell 7.3 + href: whats-new/what-s-new-in-powershell-73.md + - name: What's new in PowerShell 7.2 + href: whats-new/what-s-new-in-powershell-72.md - name: Migrating from Windows PowerShell 5.1 to PowerShell 7 href: whats-new/Migrating-from-Windows-PowerShell-51-to-PowerShell-7.md - name: Differences between Windows PowerShell 5.1 and PowerShell 7.x diff --git a/reference/docs-conceptual/whats-new/overview.yml b/reference/docs-conceptual/whats-new/overview.yml index 09d1cc728a5f..2342c09994c0 100644 --- a/reference/docs-conceptual/whats-new/overview.yml +++ b/reference/docs-conceptual/whats-new/overview.yml @@ -9,7 +9,7 @@ metadata: ms.topic: landing-page author: sdwheeler ms.author: sewhee - ms.date: 11/16/2023 + ms.date: 11/30/2023 # linkListType: architecture | concept | deploy | download | get-started | how-to-guide | learn | # overview | quickstart | reference | tutorial | video | whats-new @@ -38,8 +38,8 @@ landingContent: linkLists: - linkListType: whats-new links: - - text: What's new in PowerShell 5.1 - url: ../windows-powershell/whats-new/what-s-new-in-windows-powershell-50.md + - text: What is Windows PowerShell? + url: ../windows-powershell/overview.md - text: Differences between Windows PowerShell 5.1 and PowerShell 7 url: ./differences-from-windows-powershell.md - text: Migrating from Windows PowerShell 5.1 to PowerShell 7