Skip to content

Commit 944fe73

Browse files
authored
Fixes #10689 - Update TOC (#10694)
* Update example to use a scriptblock * Update TOC
1 parent 3d841fb commit 944fe73

File tree

5 files changed

+37
-34
lines changed

5 files changed

+37
-34
lines changed

reference/7.3/Microsoft.PowerShell.Core/About/about_Preference_Variables.md

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Variables that customize the behavior of PowerShell.
33
Locale: en-US
4-
ms.date: 09/29/2023
4+
ms.date: 11/30/2023
55
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3&WT.mc_id=ps-gethelp
66
schema: 2.0.0
77
title: about Preference Variables
@@ -1065,16 +1065,20 @@ information other than errors. In these cases, you can temporarily disable the
10651065
behavior and prevent non-zero exit codes from issuing errors.
10661066

10671067
```powershell
1068-
$definedPreference = $PSNativeCommandUseErrorActionPreference
1069-
$PSNativeCommandUseErrorActionPreference = $false
1070-
robocopy.exe D:\reports\operational "\\reporting\ops" CY2022Q4.md
1071-
$robocopyExitCode = $LASTEXITCODE
1072-
if ($robocopyExitCode -gt 8) {
1073-
throw "robocopy failed with exit code $robocopyExitCode"
1068+
& {
1069+
# Disable $PSNativeCommandUseErrorActionPreference for this scriptblock
1070+
$PSNativeCommandUseErrorActionPreference = $false
1071+
robocopy.exe D:\reports\operational "\\reporting\ops" CY2022Q4.md
1072+
if ($LASTEXITCODE -gt 8) {
1073+
throw "robocopy failed with exit code $LASTEXITCODE"
1074+
}
10741075
}
1075-
$PSNativeCommandUseErrorActionPreference = $definedPreference
10761076
```
10771077

1078+
In this example, the `$PSNativeCommandUseErrorActionPreference` variable is
1079+
changed inside a scriptblock. The change is local to the scriptblock. When the
1080+
scriptblock exits, the variable reverts to its previous value.
1081+
10781082
## $PSSessionApplicationName
10791083

10801084
Specifies the default application name for a remote command that uses Web

reference/7.4/Microsoft.PowerShell.Core/About/about_Preference_Variables.md

+11-7
Original file line numberDiff line numberDiff line change
@@ -1057,16 +1057,20 @@ information other than errors. In these cases, you can temporarily disable the
10571057
behavior and prevent non-zero exit codes from issuing errors.
10581058

10591059
```powershell
1060-
$definedPreference = $PSNativeCommandUseErrorActionPreference
1061-
$PSNativeCommandUseErrorActionPreference = $false
1062-
robocopy.exe D:\reports\operational "\\reporting\ops" CY2022Q4.md
1063-
$robocopyExitCode = $LASTEXITCODE
1064-
if ($robocopyExitCode -gt 8) {
1065-
throw "robocopy failed with exit code $robocopyExitCode"
1060+
& {
1061+
# Disable $PSNativeCommandUseErrorActionPreference for this scriptblock
1062+
$PSNativeCommandUseErrorActionPreference = $false
1063+
robocopy.exe D:\reports\operational "\\reporting\ops" CY2022Q4.md
1064+
if ($LASTEXITCODE -gt 8) {
1065+
throw "robocopy failed with exit code $LASTEXITCODE"
1066+
}
10661067
}
1067-
$PSNativeCommandUseErrorActionPreference = $definedPreference
10681068
```
10691069

1070+
In this example, the `$PSNativeCommandUseErrorActionPreference` variable is
1071+
changed inside a scriptblock. The change is local to the scriptblock. When the
1072+
scriptblock exits, the variable reverts to its previous value.
1073+
10701074
## $PSSessionApplicationName
10711075

10721076
Specifies the default application name for a remote command that uses Web

reference/docs-conceptual/learn/experimental-features.md

+5-8
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,14 @@ Legend
107107
The ANSI formatting features were added in PowerShell 7.2. This feature adds the `$PSStyle.FileInfo`
108108
member and enables coloring of specific file types.
109109

110-
- `$PSStyle.FileInfo.Directory` - Built-in member to specify color for directories
111-
- `$PSStyle.FileInfo.SymbolicLink` - Built-in member to specify color for symbolic links
112-
- `$PSStyle.FileInfo.Executable` - Built-in member to specify color for executables.
113-
- `$PSStyle.FileInfo.Extension` - Use this member to define colors for different file extensions.
114-
The **Extension** member pre-includes extensions for archive and PowerShell files.
110+
- `$PSStyle.FileInfo.Directory` - Built-in member to specify the color for directories
111+
- `$PSStyle.FileInfo.SymbolicLink` - Built-in member to specify the color for symbolic links
112+
- `$PSStyle.FileInfo.Executable` - Built-in member to specify the color for executables.
113+
- `$PSStyle.FileInfo.Extension` - Use this member to define the colors for different file
114+
extensions. The **Extension** member pre-includes extensions for archive and PowerShell files.
115115

116116
For more information, see [about_Automatic_Variables][05].
117117

118-
> [!NOTE]
119-
> This feature is dependent on the **PSAnsiRendering** feature that's now a standard feature.
120-
121118
### PSCommandNotFoundSuggestion
122119

123120
Recommends potential commands based on fuzzy matching search after a **CommandNotFoundException**.

reference/docs-conceptual/toc.yml

+6-8
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,12 @@ items:
247247
items:
248248
- name: Overview
249249
href: whats-new/overview.yml
250-
- name: What's new in PowerShell 7.x
251-
items:
252-
- name: What's new in PowerShell 7.4
253-
href: whats-new/what-s-new-in-powershell-74.md
254-
- name: What's new in PowerShell 7.3
255-
href: whats-new/what-s-new-in-powershell-73.md
256-
- name: What's new in PowerShell 7.2
257-
href: whats-new/what-s-new-in-powershell-72.md
250+
- name: What's new in PowerShell 7.4
251+
href: whats-new/what-s-new-in-powershell-74.md
252+
- name: What's new in PowerShell 7.3
253+
href: whats-new/what-s-new-in-powershell-73.md
254+
- name: What's new in PowerShell 7.2
255+
href: whats-new/what-s-new-in-powershell-72.md
258256
- name: Migrating from Windows PowerShell 5.1 to PowerShell 7
259257
href: whats-new/Migrating-from-Windows-PowerShell-51-to-PowerShell-7.md
260258
- name: Differences between Windows PowerShell 5.1 and PowerShell 7.x

reference/docs-conceptual/whats-new/overview.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ metadata:
99
ms.topic: landing-page
1010
author: sdwheeler
1111
ms.author: sewhee
12-
ms.date: 11/16/2023
12+
ms.date: 11/30/2023
1313

1414
# linkListType: architecture | concept | deploy | download | get-started | how-to-guide | learn |
1515
# overview | quickstart | reference | tutorial | video | whats-new
@@ -38,8 +38,8 @@ landingContent:
3838
linkLists:
3939
- linkListType: whats-new
4040
links:
41-
- text: What's new in PowerShell 5.1
42-
url: ../windows-powershell/whats-new/what-s-new-in-windows-powershell-50.md
41+
- text: What is Windows PowerShell?
42+
url: ../windows-powershell/overview.md
4343
- text: Differences between Windows PowerShell 5.1 and PowerShell 7
4444
url: ./differences-from-windows-powershell.md
4545
- text: Migrating from Windows PowerShell 5.1 to PowerShell 7

0 commit comments

Comments
 (0)