diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Files.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Files.md index 052731dcb306..4008bd891bcc 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Files.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Files.md @@ -1,5 +1,5 @@ --- -description: Describes how to use PowerShell data (.psd1) files. +description: Describes how to use PowerShell data (`.psd1`) files. Locale: en-US ms.date: 01/19/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_data_files?view=powershell-5.1&WT.mc_id=ps-gethelp @@ -55,7 +55,7 @@ you aren't limited to storing string data and don't have to use the data for localized output. The data in the file isn't limited to hashtables. It can be in any format -supported by the PowerShell syntax, such as `DATA` sections. +supported by the PowerShell syntax, such as `data` sections. For more information, see [about_Data_Sections][01]. diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Sections.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Sections.md index 06006bf0e140..b285bb96135f 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Sections.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Sections.md @@ -10,14 +10,14 @@ title: about_Data_Sections ## Short description -Explains `DATA` sections, which isolate text strings and other read-only +Explains `data` sections, which isolate text strings and other read-only data from script logic. ## Long description -Scripts that are designed for PowerShell can have one or more `DATA` sections -that contain only data. You can include one or more `DATA` sections in any -script, function, or advanced function. The content of the `DATA` section is +Scripts that are designed for PowerShell can have one or more `data` sections +that contain only data. You can include one or more `data` sections in any +script, function, or advanced function. The content of the `data` section is restricted to a specified subset of the PowerShell scripting language. Separating data from code logic makes it easier to identify and manage both @@ -25,27 +25,27 @@ logic and data. It lets you have separate string resource files for text, such as error messages and Help strings. It also isolates the code logic, which facilitates security and validation tests. -In PowerShell, you can use the `DATA` section to support script -internationalization. You can use `DATA` sections to make it easier to isolate, +In PowerShell, you can use the `data` section to support script +internationalization. You can use `data` sections to make it easier to isolate, locate, and process strings that can be translated into other languages. -The `DATA` section was added in PowerShell 2.0 feature. +The `data` section was added in PowerShell 2.0 feature. ### Syntax -The syntax for a `DATA` section is as follows: +The syntax for a `data` section is as follows: ```Syntax -DATA [] [-supportedCommand ] { +data [] [-SupportedCommand ] { } ``` -The `DATA` keyword is required. It isn't case-sensitive. The permitted content +The `data` keyword is required. It isn't case-sensitive. The permitted content is limited to the following elements: - All PowerShell operators, except `-match` -- `If`, `Else`, and `ElseIf` statements +- `if`, `else`, and `elseif` statements - The following automatic variables: `$PSCulture`, `$PSUICulture`, `$true`, `$false`, and `$null` - Comments @@ -60,17 +60,17 @@ is limited to the following elements: "PowerShell 2.0" @( "red", "green", "blue" ) @{ a = 0x1; b = "great"; c ="script" } - [XML] @' + [xml] @'

Hello, World

'@ ``` -- Cmdlets that are permitted in a `DATA` section. By default, only the +- Cmdlets that are permitted in a `data` section. By default, only the `ConvertFrom-StringData` cmdlet is permitted. -- Cmdlets that you permit in a `DATA` section by using the `-SupportedCommand` +- Cmdlets that you permit in a `data` section by using the `-SupportedCommand` parameter. -When you use the `ConvertFrom-StringData` cmdlet in a `DATA` section, you can +When you use the `ConvertFrom-StringData` cmdlet in a `data` section, you can enclose the key-value pairs in single-quoted or double-quoted strings or in single-quoted or double-quoted here-strings. However, strings that contain variables and subexpressions must be enclosed in single-quoted strings or in @@ -81,34 +81,34 @@ subexpressions aren't executable. The **SupportedCommand** parameter allows you to indicate that a cmdlet or function generates only data. It's designed to allow users to include cmdlets -and functions in a `DATA` section that they have written or tested. +and functions in a `data` section that they have written or tested. The value of **SupportedCommand** is a comma-separated list of one or more cmdlet or function names. -For example, the following `DATA` section includes a user-written cmdlet, +For example, the following `data` section includes a user-written cmdlet, `Format-Xml`, that formats data in an XML file: ```powershell -DATA -supportedCommand Format-Xml +data -SupportedCommand Format-Xml { Format-Xml -Strings string1, string2, string3 } ``` -### Using a `DATA` Section +### Using a `data` Section -To use the content of a `DATA` section, assign it to a variable and use +To use the content of a `data` section, assign it to a variable and use variable notation to access the content. -For example, the following `DATA` section contains a `ConvertFrom-StringData` +For example, the following `data` section contains a `ConvertFrom-StringData` command that converts the here-string into a hash table. The hash table is assigned to the `$TextMsgs` variable. -The `$TextMsgs` variable isn't part of the `DATA` section. +The `$TextMsgs` variable isn't part of the `data` section. ```powershell -$TextMsgs = DATA { +$TextMsgs = data { ConvertFrom-StringData -StringData @' Text001 = Windows 7 Text002 = Windows Server 2008 R2 @@ -124,11 +124,11 @@ $TextMsgs.Text001 $TextMsgs.Text002 ``` -Alternately, you can put the variable name in the definition of the `DATA` +Alternately, you can put the variable name in the definition of the `data` section. For example: ```powershell -DATA TextMsgs { +data TextMsgs { ConvertFrom-StringData -StringData @' Text001 = Windows 7 Text002 = Windows Server 2008 R2 @@ -152,7 +152,7 @@ Text002 Windows Server 2008 R2 Simple data strings. ```powershell -DATA { +data { "Thank you for using my PowerShell Organize.pst script." "It is provided free of charge to the community." "I appreciate your comments and feedback." @@ -162,9 +162,9 @@ DATA { Strings that include permitted variables. ```powershell -DATA { +data { if ($null) { - "To get help for this cmdlet, type get-help new-dictionary." + "To get help for this cmdlet, type Get-Help New-Dictionary." } } ``` @@ -172,7 +172,7 @@ DATA { A single-quoted here-string that uses the `ConvertFrom-StringData` cmdlet: ```powershell -DATA { +data { ConvertFrom-StringData -StringData @' Text001 = Windows 7 Text002 = Windows Server 2008 R2 @@ -183,7 +183,7 @@ Text002 = Windows Server 2008 R2 A double-quoted here-string that uses the `ConvertFrom-StringData` cmdlet: ```powershell -DATA { +data { ConvertFrom-StringData -StringData @" Msg1 = To start, press any key. Msg2 = To exit, type "quit". @@ -194,7 +194,7 @@ Msg2 = To exit, type "quit". A data section that includes a user-written cmdlet that generates data: ```powershell -DATA -supportedCommand Format-XML { +data -SupportedCommand Format-Xml { Format-Xml -Strings string1, string2, string3 } ``` diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Debuggers.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Debuggers.md index 1b637fa96b80..a46b486c7328 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Debuggers.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Debuggers.md @@ -96,7 +96,7 @@ menu. you are debugging a job by running the `Debug-Job` cmdlet, the `Exit` command detaches the debugger, and allows the job to continue running. -- `k`, `Get-PsCallStack`: Displays the current call stack. +- `k`, `Get-PSCallStack`: Displays the current call stack. - ``: Repeats the last command if it was `Step` (`s`), `StepOver` (`v`), or `List` (`l`). Otherwise, represents a submit action. @@ -308,7 +308,7 @@ sections, the debugger breaks at the first line of each section. For example: ```powershell -function test-cmdlet { +function Test-Cmdlet { begin { Write-Output "Begin" } @@ -320,32 +320,32 @@ function test-cmdlet { } } -C:\PS> Set-PSBreakpoint -Command test-cmdlet +C:\PS> Set-PSBreakpoint -Command Test-Cmdlet -C:\PS> test-cmdlet +C:\PS> Test-Cmdlet Begin Entering debug mode. Use h or ? for help. -Hit Command breakpoint on 'prompt:test-cmdlet' +Hit Command breakpoint on 'prompt:Test-Cmdlet' -test-cmdlet +Test-Cmdlet [DBG]: C:\PS> c Process Entering debug mode. Use h or ? for help. -Hit Command breakpoint on 'prompt:test-cmdlet' +Hit Command breakpoint on 'prompt:Test-Cmdlet' -test-cmdlet +Test-Cmdlet [DBG]: C:\PS> c End Entering debug mode. Use h or ? for help. -Hit Command breakpoint on 'prompt:test-cmdlet' +Hit Command breakpoint on 'prompt:Test-Cmdlet' -test-cmdlet +Test-Cmdlet [DBG]: C:\PS> ``` @@ -436,7 +436,7 @@ function psversion { "Upgrade to PowerShell 7!" } else { - "Have you run a background job today (start-job)?" + "Have you run a background job today (Start-Job)?" } } @@ -545,7 +545,7 @@ steps to the next statement in the script. ```powershell DBG> o Windows PowerShell 2.0 -Have you run a background job today (start-job)? +Have you run a background job today (Start-Job)? test.ps1:13 "Done $scriptName" ``` @@ -562,9 +562,9 @@ indicates that the debugger has exited and returned control to the command processor. Now, run the debugger again. First, to delete the current breakpoint, use the -`Get-PsBreakpoint` and `Remove-PsBreakpoint` cmdlets. (If you think you might -reuse the breakpoint, use the `Disable-PsBreakpoint` cmdlet instead of -`Remove-PsBreakpoint`.) +`Get-PSBreakpoint` and `Remove-PSBreakpoint` cmdlets. (If you think you might +reuse the breakpoint, use the `Disable-PSBreakpoint` cmdlet instead of +`Remove-PSBreakpoint`.) ```powershell PS C:\ps-test> Get-PSBreakpoint | Remove-PSBreakpoint @@ -638,7 +638,7 @@ displayed, but it isn't executed. ```powershell DBG> v Windows PowerShell 2.0 -Have you run a background job today (start-job)? +Have you run a background job today (Start-Job)? test.ps1:13 "Done $scriptName" ``` @@ -652,7 +652,7 @@ the standard command prompt. C:\ps-test> ``` -To delete the breakpoints, use the `Get-PsBreakpoint` and `Remove-PsBreakpoint` +To delete the breakpoints, use the `Get-PSBreakpoint` and `Remove-PSBreakpoint` cmdlets. ```powershell @@ -688,13 +688,13 @@ the breakpoint or to perform preparatory or diagnostic tasks, such as starting a log or invoking a diagnostic or security script. To set an action, use a Continue command (c) to exit the script, and a -`Remove-PsBreakpoint` command to delete the current breakpoint. (Breakpoints +`Remove-PSBreakpoint` command to delete the current breakpoint. (Breakpoints are read-only, so you can't add an action to the current breakpoint.) ```powershell DBG> c Windows PowerShell 2.0 -Have you run a background job today (start-job)? +Have you run a background job today (Start-Job)? Done C:\ps-test\test.ps1 PS C:\ps-test> Get-PSBreakpoint | Remove-PSBreakpoint @@ -741,7 +741,7 @@ Because the execution policy is set to **RemoteSigned**, execution stops at the function call. At this point, you might want to check the call stack. Use the -`Get-PsCallStack` cmdlet or the `Get-PsCallStack` debugger command (`k`). The +`Get-PSCallStack` cmdlet or the `Get-PSCallStack` debugger command (`k`). The following command gets the current call stack. ```powershell diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Do.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Do.md index ef94c7e8cdd2..cdcb94c067f8 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Do.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Do.md @@ -1,5 +1,5 @@ --- -description: Runs a statement list one or more times, subject to a While or Until condition. +description: Runs a statement list one or more times, subject to a `while` or `until` condition. Locale: en-US ms.date: 06/10/2021 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_do?view=powershell-5.1&WT.mc_id=ps-gethelp @@ -9,24 +9,24 @@ title: about_Do # about_Do ## Short description -Runs a statement list one or more times, subject to a `While` or `Until` +Runs a statement list one or more times, subject to a `while` or `until` condition. ## Long description -The `Do` keyword works with the `While` keyword or the `Until` keyword to run +The `do` keyword works with the `while` keyword or the `until` keyword to run the statements in a script block, subject to a condition. Unlike the related -`While` loop, the script block in a `Do` loop always runs at least once. +`while` loop, the script block in a `do` loop always runs at least once. -A **Do-While** loop is a variety of the `While` loop. In a **Do-While** loop, -the condition is evaluated after the script block has run. As in a While loop, -the script block is repeated as long as the condition evaluates to true. +A **Do-While** loop is a variety of the `while` loop. In a **Do-While** loop, +the condition is evaluated after the script block has run. As in a `while` +loop, the script block is repeated as long as the condition evaluates to true. Like a **Do-While** loop, a **Do-Until** loop always runs at least once before the condition is evaluated. However, the script block runs only while the condition is false. -The `Continue` and `Break` flow control keywords can be used in a **Do-While** +The `continue` and `break` flow control keywords can be used in a **Do-While** loop or in a **Do-Until** loop. ### Syntax @@ -52,7 +52,7 @@ information about how booleans are evaluated, see ### Example -The following example of a `Do` statement counts the items in an array until it +The following example of a `do` statement counts the items in an array until it reaches an item with a value of 0. ```powershell @@ -62,7 +62,7 @@ PS> $count 3 ``` -The following example uses the `Until` keyword. Notice that the not equal to +The following example uses the `until` keyword. Notice that the not equal to operator (`-ne`) is replaced by the equal to operator (`-eq`). ```powershell diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Enum.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Enum.md index dfef0d01190c..2271ee6ad7c5 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Enum.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Enum.md @@ -45,7 +45,7 @@ Enumerations use the following syntaxes: ### Flag enumeration definition syntax ```Syntax -[[]...] [Flag()] enum [ : ] { +[[]...] [Flags()] enum [ : ] {