diff --git a/.openpublishing.redirection.json b/.openpublishing.redirection.json index 52bc25d573e..65397bfb00c 100644 --- a/.openpublishing.redirection.json +++ b/.openpublishing.redirection.json @@ -1,5 +1,10 @@ { "redirections": [ + { + "redirect_document_id": true, + "redirect_url": "/powershell/scripting/what-is-windows-powershell", + "source_path": "reference/docs-conceptual/windows-powershell/overview.md" + }, { "redirect_document_id": true, "redirect_url": "/powershell/scripting/learn/shell/optimize-shell", diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Arrays.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Arrays.md index 0af468e646c..fddace5fbfb 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Arrays.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Arrays.md @@ -1,7 +1,7 @@ --- description: Describes arrays, which are data structures designed to store collections of items. Locale: en-US -ms.date: 01/17/2023 +ms.date: 03/07/2024 no-loc: [Count, Length, LongLength, Rank, ForEach, Clear, Default, First, Last, SkipUntil, Until, Split, Tuple] online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_arrays?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 @@ -894,38 +894,78 @@ In Windows PowerShell, objects created by casting a **Hashtable** to `[pscustomobject]` do not have the **Length** or **Count** properties. Attempting to access these members returns `$null`. -The following examples demonstrate this feature. - -### Zero objects +The following example shows that a variable that contains no objects has a +**Count** and **Length** of 0. ```powershell -$a = $null -$a.Count -$a.Length -``` - -```Output +PS> $a = $null +PS> $a.Count 0 +PS> $a.Length 0 ``` -### One object +The following example shows that a variable that contains one object has a +**Count** and **Length** of 1. You can also use array indexing to access the +value of the object. ```powershell -$a = 4 -$a.Count -$a.Length -$a[0] -$a[-1] +PS> $a = 4 +PS> $a.Count +1 +PS> $a.Length +1 +PS> $a[0] +4 +PS> $a[-1] +4 ``` -```Output -1 +When you run a command that could return a collection or a single object, you +can use array indexing to access the value of the object without having to test +the **Count** or **Length** properties. However, if the result is a single +object (singleton), and that object has a **Count** or **Length** property, the +value of those properties belong to the singleton object and don't represent +the number of items in the collection. + +In the following example, the command returns a single string object. The +**Length** of that string is `4`. + +```powershell +PS> $result = 'one','two','three','four' | Where-Object {$_ -like 'f*'} +PS> $result.GetType().FullName +System.String +PS> $result +four +PS> $result.Count 1 +PS❯ $result.Length 4 +``` + +If you want `$result` to be an array of strings, you need to declare the +variable as an array. + +In this example, `$result` is an array of strings. The **Count** and **Length** +of the array is `1`, and the **Length** of the first element is `4`. + +```powershell +PS> [string[]]$result = 'one','two','three','four' | + Where-Object {$_ -like 'f*'} +PS> $result.GetType().FullName +System.String[] +PS> $result +four +PS> $result.Count +1 +PS> $result.Length +1 +PS> $result[0].Length 4 ``` + + ## Indexing .NET types that implement `IDictionary` PowerShell doesn't call a type's true indexer for types that implement the diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Variables.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Variables.md index f19a636152b..c83634b65ce 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Variables.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Variables.md @@ -1,7 +1,7 @@ --- description: Describes how variables store values that can be used in PowerShell. Locale: en-US -ms.date: 08/28/2021 +ms.date: 03/07/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_variables?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Variables @@ -26,7 +26,7 @@ such as `$a`, `$process`, or `$my_var`. Variable names aren't case-sensitive, and can include spaces and special characters. But, variable names that include special characters and spaces are difficult to use and should be avoided. For more information, see -[Variable names that include special characters](#variable-names-that-include-special-characters). +[Variable names that include special characters][01]. There are several different types of variables in PowerShell. @@ -44,7 +44,7 @@ There are several different types of variables in PowerShell. PowerShell installation directory. For more information, a list, and a description of the automatic variables, - see [about_Automatic_Variables](about_Automatic_Variables.md). + see [about_Automatic_Variables][04]. - Preference variables: Preference variables store user preferences for PowerShell. These variables are created by PowerShell and are populated with @@ -53,7 +53,7 @@ There are several different types of variables in PowerShell. in the session history. For more information, a list, and a description of the preference variables, - see [about_Preference_Variables](about_Preference_Variables.md). + see [about_Preference_Variables][08]. ## Working with variables @@ -142,8 +142,7 @@ Clear-Variable -Name MyVariable $MyVariable = $null ``` -To delete the variable, use [Remove-Variable](xref:Microsoft.PowerShell.Utility.Remove-Variable) -or [Remove-Item](xref:Microsoft.PowerShell.Management.Remove-Item). +To delete the variable, use [Remove-Variable][16] or [Remove-Item][14]. ```powershell Remove-Variable -Name MyVariable @@ -168,7 +167,7 @@ $i,$j = 10, "red", $true # $i is 10, $j is [object[]], Length 2 ``` For more detailed information, see the **Assigning multiple variables** section -of [about_Assignment_Operators](about_assignment_operators.md#assigning-multiple-variables). +of [about_Assignment_Operators][03]. ## Types of variables @@ -181,8 +180,7 @@ a particular type of object. A single variable can even contain a collection, or array, of different types of objects at the same time. The data type of a variable is determined by the .NET types of the values of -the variable. To view a variable's object type, use -[Get-Member](xref:Microsoft.PowerShell.Utility.Get-Member). +the variable. To view a variable's object type, use [Get-Member][15]. For example: @@ -212,8 +210,8 @@ $number = "Hello" ``` ```Output -Cannot convert value "Hello" to type "System.Int32". Error: "Input string was - not in a correct format." +Cannot convert value "Hello" to type "System.Int32". Error: "Input string +was not in a correct format." At line:1 char:1 + $number = "Hello" + ~~~~~~~~~~~~~~~~~ @@ -264,7 +262,7 @@ If the variable name and dollar sign are enclosed in single quotation (`'`) marks, the variable name is used in the expression. For more information about using quotation marks in PowerShell, see -[about_Quoting_Rules](about_Quoting_Rules.md). +[about_Quoting_Rules][10]. This example gets the value of the `$PROFILE` variable, which is the path to the PowerShell user profile file in the PowerShell console. @@ -274,7 +272,7 @@ $PROFILE ``` ```Output -C:\Users\User01\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 +C:\Users\User01\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 ``` In this example, two commands are shown that can open the PowerShell profile in @@ -324,7 +322,7 @@ Alphanumeric variable names can contain these characters: - Question mark (`?`) character. The following list contains the Unicode category descriptions. For more -information, see [UnicodeCategory](/dotnet/api/system.globalization.unicodecategory). +information, see [UnicodeCategory][17]. - **Lu** - UppercaseLetter - **Ll** - LowercaseLetter @@ -347,7 +345,7 @@ Special character variable names can contain these characters: PowerShell has reserved variables such as `$$`, `$?`, `$^`, and `$_` that contain alphanumeric and special characters. For more information, see -[about_Automatic_Variables](about_automatic_variables.md). +[about_Automatic_Variables][04]. For example, the following command creates the variable named `save-items`. The curly braces (`{}`) are needed because variable name includes a hyphen (`-`) @@ -391,7 +389,7 @@ By default, variables are only available in the scope in which they're created. For example, a variable that you create in a function is available only within the function. A variable that you create in a script is available only within the script. If you dot-source the script, the variable is added to the current -scope. For more information, see [about_Scopes](about_Scopes.md). +scope. For more information, see [about_Scopes][12]. You can use a scope modifier to change the default scope of the variable. The following expression creates a variable named `Computers`. The variable has a @@ -405,7 +403,7 @@ For any script or command that executes out of session, you need the `Using` scope modifier to embed variable values from the calling session scope, so that out of session code can access them. -For more information, see [about_Remote_Variables](about_Remote_Variables.md). +For more information, see [about_Remote_Variables][11]. ## Saving variables @@ -424,7 +422,7 @@ $VerbosePreference = "Continue" You can add this command to your PowerShell profile by opening the `$PROFILE` file in a text editor, such as **notepad.exe**. For more information about -PowerShell profiles, see [about_Profiles](about_Profiles.md). +PowerShell profiles, see [about_Profiles][09]. ## The Variable: drive @@ -469,16 +467,15 @@ Get-Help Variable ## Variable syntax with provider paths You can prefix a provider path with the dollar (`$`) sign, and access the -content of any provider that implements the -[IContentCmdletProvider](/dotnet/api/system.management.automation.provider.icontentcmdletprovider) +content of any provider that implements the [IContentCmdletProvider][18] interface. The following built-in PowerShell providers support this notation: -- [about_Environment_Provider](about_Environment_Provider.md) -- [about_Variable_Provider](about_Variable_Provider.md) -- [about_Function_Provider](about_Function_Provider.md) -- [about_Alias_Provider](about_Alias_Provider.md) +- [about_Environment_Provider][05] +- [about_Variable_Provider][13] +- [about_Function_Provider][07] +- [about_Alias_Provider][02] ## The variable cmdlets @@ -496,8 +493,8 @@ To get help for a specific cmdlet, type: Get-Help ``` -| Cmdlet Name | Description | -| --------------- | ------------------------------------------ | +| Cmdlet Name | Description | +| ----------------- | ------------------------------------------ | | `Clear-Variable` | Deletes the value of a variable. | | `Get-Variable` | Gets the variables in the current console. | | `New-Variable` | Creates a new variable. | @@ -506,10 +503,30 @@ Get-Help ## See also -- [about_Automatic_Variables](about_Automatic_Variables.md) -- [about_Environment_Variables](about_Environment_Variables.md) -- [about_Preference_Variables](about_Preference_Variables.md) -- [about_Profiles](about_Profiles.md) -- [about_Quoting_Rules](about_Quoting_Rules.md) -- [about_Remote_Variables](about_Remote_Variables.md) -- [about_Scopes](about_Scopes.md) +- [about_Automatic_Variables][04] +- [about_Environment_Variables][06] +- [about_Preference_Variables][08] +- [about_Profiles][09] +- [about_Quoting_Rules][10] +- [about_Remote_Variables][11] +- [about_Scopes][12] + + +[01]: #variable-names-that-include-special-characters +[02]: about_Alias_Provider.md +[03]: about_assignment_operators.md#assigning-multiple-variables +[04]: about_Automatic_Variables.md +[05]: about_Environment_Provider.md +[06]: about_Environment_Variables.md +[07]: about_Function_Provider.md +[08]: about_Preference_Variables.md +[09]: about_Profiles.md +[10]: about_Quoting_Rules.md +[11]: about_Remote_Variables.md +[12]: about_Scopes.md +[13]: about_Variable_Provider.md +[14]: xref:Microsoft.PowerShell.Management.Remove-Item +[15]: xref:Microsoft.PowerShell.Utility.Get-Member +[16]: xref:Microsoft.PowerShell.Utility.Remove-Variable +[17]: xref:System.Globalization.UnicodeCategory +[18]: xref:System.Management.Automation.Provider.IContentCmdletProvider diff --git a/reference/7.2/Microsoft.PowerShell.Core/About/about_Arrays.md b/reference/7.2/Microsoft.PowerShell.Core/About/about_Arrays.md index 2dad34dfdac..3d59f718881 100644 --- a/reference/7.2/Microsoft.PowerShell.Core/About/about_Arrays.md +++ b/reference/7.2/Microsoft.PowerShell.Core/About/about_Arrays.md @@ -1,7 +1,7 @@ --- description: Describes arrays, which are data structures designed to store collections of items. Locale: en-US -ms.date: 01/17/2023 +ms.date: 03/07/2024 no-loc: [Count, Length, LongLength, Rank, ForEach, Clear, Default, First, Last, SkipUntil, Until, Split, Tuple] online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_arrays?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 @@ -889,35 +889,73 @@ Beginning in Windows PowerShell 3.0, a collection of zero or one object has the object. This feature helps you to avoid scripting errors that occur when a command that expects a collection gets fewer than two items. -The following examples demonstrate this feature. - -### Zero objects +The following example shows that a variable that contains no objects has a +**Count** and **Length** of 0. ```powershell -$a = $null -$a.Count -$a.Length -``` - -```Output +PS> $a = $null +PS> $a.Count 0 +PS> $a.Length 0 ``` -### One object +The following example shows that a variable that contains one object has a +**Count** and **Length** of 1. You can also use array indexing to access the +value of the object. ```powershell -$a = 4 -$a.Count -$a.Length -$a[0] -$a[-1] +PS> $a = 4 +PS> $a.Count +1 +PS> $a.Length +1 +PS> $a[0] +4 +PS> $a[-1] +4 ``` -```Output -1 +When you run a command that could return a collection or a single object, you +can use array indexing to access the value of the object without having to test +the **Count** or **Length** properties. However, if the result is a single +object (singleton), and that object has a **Count** or **Length** property, the +value of those properties belong to the singleton object and don't represent +the number of items in the collection. + +In the following example, the command returns a single string object. The +**Length** of that string is `4`. + +```powershell +PS> $result = 'one','two','three','four' | Where-Object {$_ -like 'f*'} +PS> $result.GetType().FullName +System.String +PS> $result +four +PS> $result.Count 1 +PS❯ $result.Length 4 +``` + +If you want `$result` to be an array of strings, you need to declare the +variable as an array. + +In this example, `$result` is an array of strings. The **Count** and **Length** +of the array is `1`, and the **Length** of the first element is `4`. + +```powershell +PS> [string[]]$result = 'one','two','three','four' | + Where-Object {$_ -like 'f*'} +PS> $result.GetType().FullName +System.String[] +PS> $result +four +PS> $result.Count +1 +PS> $result.Length +1 +PS> $result[0].Length 4 ``` diff --git a/reference/7.2/Microsoft.PowerShell.Core/About/about_Variables.md b/reference/7.2/Microsoft.PowerShell.Core/About/about_Variables.md index 1f24129c050..b9139ebf09d 100644 --- a/reference/7.2/Microsoft.PowerShell.Core/About/about_Variables.md +++ b/reference/7.2/Microsoft.PowerShell.Core/About/about_Variables.md @@ -1,7 +1,7 @@ --- description: Describes how variables store values that can be used in PowerShell. Locale: en-US -ms.date: 08/28/2021 +ms.date: 03/07/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_variables?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Variables @@ -26,7 +26,7 @@ such as `$a`, `$process`, or `$my_var`. Variable names aren't case-sensitive, and can include spaces and special characters. But, variable names that include special characters and spaces are difficult to use and should be avoided. For more information, see -[Variable names that include special characters](#variable-names-that-include-special-characters). +[Variable names that include special characters][01]. There are several different types of variables in PowerShell. @@ -44,7 +44,7 @@ There are several different types of variables in PowerShell. PowerShell installation directory. For more information, a list, and a description of the automatic variables, - see [about_Automatic_Variables](about_Automatic_Variables.md). + see [about_Automatic_Variables][04]. - Preference variables: Preference variables store user preferences for PowerShell. These variables are created by PowerShell and are populated with @@ -53,7 +53,7 @@ There are several different types of variables in PowerShell. in the session history. For more information, a list, and a description of the preference variables, - see [about_Preference_Variables](about_Preference_Variables.md). + see [about_Preference_Variables][08]. ## Working with variables @@ -142,8 +142,7 @@ Clear-Variable -Name MyVariable $MyVariable = $null ``` -To delete the variable, use [Remove-Variable](xref:Microsoft.PowerShell.Utility.Remove-Variable) -or [Remove-Item](xref:Microsoft.PowerShell.Management.Remove-Item). +To delete the variable, use [Remove-Variable][16] or [Remove-Item][14]. ```powershell Remove-Variable -Name MyVariable @@ -168,7 +167,7 @@ $i,$j = 10, "red", $true # $i is 10, $j is [object[]], Length 2 ``` For more detailed information, see the **Assigning multiple variables** section -of [about_Assignment_Operators](about_assignment_operators.md#assigning-multiple-variables). +of [about_Assignment_Operators][03]. ## Types of variables @@ -181,8 +180,7 @@ a particular type of object. A single variable can even contain a collection, or array, of different types of objects at the same time. The data type of a variable is determined by the .NET types of the values of -the variable. To view a variable's object type, use -[Get-Member](xref:Microsoft.PowerShell.Utility.Get-Member). +the variable. To view a variable's object type, use [Get-Member][15]. For example: @@ -212,8 +210,8 @@ $number = "Hello" ``` ```Output -Cannot convert value "Hello" to type "System.Int32". Error: "Input string was - not in a correct format." +Cannot convert value "Hello" to type "System.Int32". Error: "Input string +was not in a correct format." At line:1 char:1 + $number = "Hello" + ~~~~~~~~~~~~~~~~~ @@ -264,7 +262,7 @@ If the variable name and dollar sign are enclosed in single quotation (`'`) marks, the variable name is used in the expression. For more information about using quotation marks in PowerShell, see -[about_Quoting_Rules](about_Quoting_Rules.md). +[about_Quoting_Rules][10]. This example gets the value of the `$PROFILE` variable, which is the path to the PowerShell user profile file in the PowerShell console. @@ -324,7 +322,7 @@ Alphanumeric variable names can contain these characters: - Question mark (`?`) character. The following list contains the Unicode category descriptions. For more -information, see [UnicodeCategory](/dotnet/api/system.globalization.unicodecategory). +information, see [UnicodeCategory][17]. - **Lu** - UppercaseLetter - **Ll** - LowercaseLetter @@ -347,7 +345,7 @@ Special character variable names can contain these characters: PowerShell has reserved variables such as `$$`, `$?`, `$^`, and `$_` that contain alphanumeric and special characters. For more information, see -[about_Automatic_Variables](about_automatic_variables.md). +[about_Automatic_Variables][04]. For example, the following command creates the variable named `save-items`. The curly braces (`{}`) are needed because variable name includes a hyphen (`-`) @@ -391,7 +389,7 @@ By default, variables are only available in the scope in which they're created. For example, a variable that you create in a function is available only within the function. A variable that you create in a script is available only within the script. If you dot-source the script, the variable is added to the current -scope. For more information, see [about_Scopes](about_Scopes.md). +scope. For more information, see [about_Scopes][12]. You can use a scope modifier to change the default scope of the variable. The following expression creates a variable named `Computers`. The variable has a @@ -405,7 +403,7 @@ For any script or command that executes out of session, you need the `Using` scope modifier to embed variable values from the calling session scope, so that out of session code can access them. -For more information, see [about_Remote_Variables](about_Remote_Variables.md). +For more information, see [about_Remote_Variables][11]. ## Saving variables @@ -424,7 +422,7 @@ $VerbosePreference = "Continue" You can add this command to your PowerShell profile by opening the `$PROFILE` file in a text editor, such as **notepad.exe**. For more information about -PowerShell profiles, see [about_Profiles](about_Profiles.md). +PowerShell profiles, see [about_Profiles][09]. ## The Variable: drive @@ -469,16 +467,15 @@ Get-Help Variable ## Variable syntax with provider paths You can prefix a provider path with the dollar (`$`) sign, and access the -content of any provider that implements the -[IContentCmdletProvider](/dotnet/api/system.management.automation.provider.icontentcmdletprovider) +content of any provider that implements the [IContentCmdletProvider][18] interface. The following built-in PowerShell providers support this notation: -- [about_Environment_Provider](about_Environment_Provider.md) -- [about_Variable_Provider](about_Variable_Provider.md) -- [about_Function_Provider](about_Function_Provider.md) -- [about_Alias_Provider](about_Alias_Provider.md) +- [about_Environment_Provider][05] +- [about_Variable_Provider][13] +- [about_Function_Provider][07] +- [about_Alias_Provider][02] ## The variable cmdlets @@ -496,8 +493,8 @@ To get help for a specific cmdlet, type: Get-Help ``` -| Cmdlet Name | Description | -| --------------- | ------------------------------------------ | +| Cmdlet Name | Description | +| ----------------- | ------------------------------------------ | | `Clear-Variable` | Deletes the value of a variable. | | `Get-Variable` | Gets the variables in the current console. | | `New-Variable` | Creates a new variable. | @@ -506,10 +503,30 @@ Get-Help ## See also -- [about_Automatic_Variables](about_Automatic_Variables.md) -- [about_Environment_Variables](about_Environment_Variables.md) -- [about_Preference_Variables](about_Preference_Variables.md) -- [about_Profiles](about_Profiles.md) -- [about_Quoting_Rules](about_Quoting_Rules.md) -- [about_Remote_Variables](about_Remote_Variables.md) -- [about_Scopes](about_Scopes.md) +- [about_Automatic_Variables][04] +- [about_Environment_Variables][06] +- [about_Preference_Variables][08] +- [about_Profiles][09] +- [about_Quoting_Rules][10] +- [about_Remote_Variables][11] +- [about_Scopes][12] + + +[01]: #variable-names-that-include-special-characters +[02]: about_Alias_Provider.md +[03]: about_assignment_operators.md#assigning-multiple-variables +[04]: about_Automatic_Variables.md +[05]: about_Environment_Provider.md +[06]: about_Environment_Variables.md +[07]: about_Function_Provider.md +[08]: about_Preference_Variables.md +[09]: about_Profiles.md +[10]: about_Quoting_Rules.md +[11]: about_Remote_Variables.md +[12]: about_Scopes.md +[13]: about_Variable_Provider.md +[14]: xref:Microsoft.PowerShell.Management.Remove-Item +[15]: xref:Microsoft.PowerShell.Utility.Get-Member +[16]: xref:Microsoft.PowerShell.Utility.Remove-Variable +[17]: xref:System.Globalization.UnicodeCategory +[18]: xref:System.Management.Automation.Provider.IContentCmdletProvider diff --git a/reference/7.3/Microsoft.PowerShell.Core/About/about_Arrays.md b/reference/7.3/Microsoft.PowerShell.Core/About/about_Arrays.md index 27cb49fb4ec..2d38de0d8d5 100644 --- a/reference/7.3/Microsoft.PowerShell.Core/About/about_Arrays.md +++ b/reference/7.3/Microsoft.PowerShell.Core/About/about_Arrays.md @@ -1,7 +1,7 @@ --- description: Describes arrays, which are data structures designed to store collections of items. Locale: en-US -ms.date: 01/17/2023 +ms.date: 03/07/2024 no-loc: [Count, Length, LongLength, Rank, ForEach, Clear, Default, First, Last, SkipUntil, Until, Split, Tuple] online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_arrays?view=powershell-7.3&WT.mc_id=ps-gethelp schema: 2.0.0 @@ -889,35 +889,73 @@ Beginning in Windows PowerShell 3.0, a collection of zero or one object has the object. This feature helps you to avoid scripting errors that occur when a command that expects a collection gets fewer than two items. -The following examples demonstrate this feature. - -### Zero objects +The following example shows that a variable that contains no objects has a +**Count** and **Length** of 0. ```powershell -$a = $null -$a.Count -$a.Length -``` - -```Output +PS> $a = $null +PS> $a.Count 0 +PS> $a.Length 0 ``` -### One object +The following example shows that a variable that contains one object has a +**Count** and **Length** of 1. You can also use array indexing to access the +value of the object. ```powershell -$a = 4 -$a.Count -$a.Length -$a[0] -$a[-1] +PS> $a = 4 +PS> $a.Count +1 +PS> $a.Length +1 +PS> $a[0] +4 +PS> $a[-1] +4 ``` -```Output -1 +When you run a command that could return a collection or a single object, you +can use array indexing to access the value of the object without having to test +the **Count** or **Length** properties. However, if the result is a single +object (singleton), and that object has a **Count** or **Length** property, the +value of those properties belong to the singleton object and don't represent +the number of items in the collection. + +In the following example, the command returns a single string object. The +**Length** of that string is `4`. + +```powershell +PS> $result = 'one','two','three','four' | Where-Object {$_ -like 'f*'} +PS> $result.GetType().FullName +System.String +PS> $result +four +PS> $result.Count 1 +PS❯ $result.Length 4 +``` + +If you want `$result` to be an array of strings, you need to declare the +variable as an array. + +In this example, `$result` is an array of strings. The **Count** and **Length** +of the array is `1`, and the **Length** of the first element is `4`. + +```powershell +PS> [string[]]$result = 'one','two','three','four' | + Where-Object {$_ -like 'f*'} +PS> $result.GetType().FullName +System.String[] +PS> $result +four +PS> $result.Count +1 +PS> $result.Length +1 +PS> $result[0].Length 4 ``` diff --git a/reference/7.3/Microsoft.PowerShell.Core/About/about_Variables.md b/reference/7.3/Microsoft.PowerShell.Core/About/about_Variables.md index c1586c3d1fc..e25751d31d7 100644 --- a/reference/7.3/Microsoft.PowerShell.Core/About/about_Variables.md +++ b/reference/7.3/Microsoft.PowerShell.Core/About/about_Variables.md @@ -1,7 +1,7 @@ --- description: Describes how variables store values that can be used in PowerShell. Locale: en-US -ms.date: 08/28/2021 +ms.date: 03/07/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_variables?view=powershell-7.3&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Variables @@ -26,7 +26,7 @@ such as `$a`, `$process`, or `$my_var`. Variable names aren't case-sensitive, and can include spaces and special characters. But, variable names that include special characters and spaces are difficult to use and should be avoided. For more information, see -[Variable names that include special characters](#variable-names-that-include-special-characters). +[Variable names that include special characters][01]. There are several different types of variables in PowerShell. @@ -44,7 +44,7 @@ There are several different types of variables in PowerShell. PowerShell installation directory. For more information, a list, and a description of the automatic variables, - see [about_Automatic_Variables](about_Automatic_Variables.md). + see [about_Automatic_Variables][04]. - Preference variables: Preference variables store user preferences for PowerShell. These variables are created by PowerShell and are populated with @@ -53,7 +53,7 @@ There are several different types of variables in PowerShell. in the session history. For more information, a list, and a description of the preference variables, - see [about_Preference_Variables](about_Preference_Variables.md). + see [about_Preference_Variables][08]. ## Working with variables @@ -142,8 +142,7 @@ Clear-Variable -Name MyVariable $MyVariable = $null ``` -To delete the variable, use [Remove-Variable](xref:Microsoft.PowerShell.Utility.Remove-Variable) -or [Remove-Item](xref:Microsoft.PowerShell.Management.Remove-Item). +To delete the variable, use [Remove-Variable][16] or [Remove-Item][14]. ```powershell Remove-Variable -Name MyVariable @@ -168,7 +167,7 @@ $i,$j = 10, "red", $true # $i is 10, $j is [object[]], Length 2 ``` For more detailed information, see the **Assigning multiple variables** section -of [about_Assignment_Operators](about_assignment_operators.md#assigning-multiple-variables). +of [about_Assignment_Operators][03]. ## Types of variables @@ -181,8 +180,7 @@ a particular type of object. A single variable can even contain a collection, or array, of different types of objects at the same time. The data type of a variable is determined by the .NET types of the values of -the variable. To view a variable's object type, use -[Get-Member](xref:Microsoft.PowerShell.Utility.Get-Member). +the variable. To view a variable's object type, use [Get-Member][15]. For example: @@ -212,8 +210,8 @@ $number = "Hello" ``` ```Output -Cannot convert value "Hello" to type "System.Int32". Error: "Input string was - not in a correct format." +Cannot convert value "Hello" to type "System.Int32". Error: "Input string +was not in a correct format." At line:1 char:1 + $number = "Hello" + ~~~~~~~~~~~~~~~~~ @@ -264,7 +262,7 @@ If the variable name and dollar sign are enclosed in single quotation (`'`) marks, the variable name is used in the expression. For more information about using quotation marks in PowerShell, see -[about_Quoting_Rules](about_Quoting_Rules.md). +[about_Quoting_Rules][10]. This example gets the value of the `$PROFILE` variable, which is the path to the PowerShell user profile file in the PowerShell console. @@ -324,7 +322,7 @@ Alphanumeric variable names can contain these characters: - Question mark (`?`) character. The following list contains the Unicode category descriptions. For more -information, see [UnicodeCategory](/dotnet/api/system.globalization.unicodecategory). +information, see [UnicodeCategory][17]. - **Lu** - UppercaseLetter - **Ll** - LowercaseLetter @@ -347,7 +345,7 @@ Special character variable names can contain these characters: PowerShell has reserved variables such as `$$`, `$?`, `$^`, and `$_` that contain alphanumeric and special characters. For more information, see -[about_Automatic_Variables](about_automatic_variables.md). +[about_Automatic_Variables][04]. For example, the following command creates the variable named `save-items`. The curly braces (`{}`) are needed because variable name includes a hyphen (`-`) @@ -391,7 +389,7 @@ By default, variables are only available in the scope in which they're created. For example, a variable that you create in a function is available only within the function. A variable that you create in a script is available only within the script. If you dot-source the script, the variable is added to the current -scope. For more information, see [about_Scopes](about_Scopes.md). +scope. For more information, see [about_Scopes][12]. You can use a scope modifier to change the default scope of the variable. The following expression creates a variable named `Computers`. The variable has a @@ -405,7 +403,7 @@ For any script or command that executes out of session, you need the `Using` scope modifier to embed variable values from the calling session scope, so that out of session code can access them. -For more information, see [about_Remote_Variables](about_Remote_Variables.md). +For more information, see [about_Remote_Variables][11]. ## Saving variables @@ -424,7 +422,7 @@ $VerbosePreference = "Continue" You can add this command to your PowerShell profile by opening the `$PROFILE` file in a text editor, such as **notepad.exe**. For more information about -PowerShell profiles, see [about_Profiles](about_Profiles.md). +PowerShell profiles, see [about_Profiles][09]. ## The Variable: drive @@ -469,16 +467,15 @@ Get-Help Variable ## Variable syntax with provider paths You can prefix a provider path with the dollar (`$`) sign, and access the -content of any provider that implements the -[IContentCmdletProvider](/dotnet/api/system.management.automation.provider.icontentcmdletprovider) +content of any provider that implements the [IContentCmdletProvider][18] interface. The following built-in PowerShell providers support this notation: -- [about_Environment_Provider](about_Environment_Provider.md) -- [about_Variable_Provider](about_Variable_Provider.md) -- [about_Function_Provider](about_Function_Provider.md) -- [about_Alias_Provider](about_Alias_Provider.md) +- [about_Environment_Provider][05] +- [about_Variable_Provider][13] +- [about_Function_Provider][07] +- [about_Alias_Provider][02] ## The variable cmdlets @@ -496,8 +493,8 @@ To get help for a specific cmdlet, type: Get-Help ``` -| Cmdlet Name | Description | -| --------------- | ------------------------------------------ | +| Cmdlet Name | Description | +| ----------------- | ------------------------------------------ | | `Clear-Variable` | Deletes the value of a variable. | | `Get-Variable` | Gets the variables in the current console. | | `New-Variable` | Creates a new variable. | @@ -506,10 +503,30 @@ Get-Help ## See also -- [about_Automatic_Variables](about_Automatic_Variables.md) -- [about_Environment_Variables](about_Environment_Variables.md) -- [about_Preference_Variables](about_Preference_Variables.md) -- [about_Profiles](about_Profiles.md) -- [about_Quoting_Rules](about_Quoting_Rules.md) -- [about_Remote_Variables](about_Remote_Variables.md) -- [about_Scopes](about_Scopes.md) +- [about_Automatic_Variables][04] +- [about_Environment_Variables][06] +- [about_Preference_Variables][08] +- [about_Profiles][09] +- [about_Quoting_Rules][10] +- [about_Remote_Variables][11] +- [about_Scopes][12] + + +[01]: #variable-names-that-include-special-characters +[02]: about_Alias_Provider.md +[03]: about_assignment_operators.md#assigning-multiple-variables +[04]: about_Automatic_Variables.md +[05]: about_Environment_Provider.md +[06]: about_Environment_Variables.md +[07]: about_Function_Provider.md +[08]: about_Preference_Variables.md +[09]: about_Profiles.md +[10]: about_Quoting_Rules.md +[11]: about_Remote_Variables.md +[12]: about_Scopes.md +[13]: about_Variable_Provider.md +[14]: xref:Microsoft.PowerShell.Management.Remove-Item +[15]: xref:Microsoft.PowerShell.Utility.Get-Member +[16]: xref:Microsoft.PowerShell.Utility.Remove-Variable +[17]: xref:System.Globalization.UnicodeCategory +[18]: xref:System.Management.Automation.Provider.IContentCmdletProvider diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Arrays.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Arrays.md index 86cbdce55bb..00199effbe5 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Arrays.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Arrays.md @@ -1,7 +1,7 @@ --- description: Describes arrays, which are data structures designed to store collections of items. Locale: en-US -ms.date: 01/17/2023 +ms.date: 03/07/2024 no-loc: [Count, Length, LongLength, Rank, ForEach, Clear, Default, First, Last, SkipUntil, Until, Split, Tuple] online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_arrays?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 @@ -889,35 +889,73 @@ Beginning in Windows PowerShell 3.0, a collection of zero or one object has the object. This feature helps you to avoid scripting errors that occur when a command that expects a collection gets fewer than two items. -The following examples demonstrate this feature. - -### Zero objects +The following example shows that a variable that contains no objects has a +**Count** and **Length** of 0. ```powershell -$a = $null -$a.Count -$a.Length -``` - -```Output +PS> $a = $null +PS> $a.Count 0 +PS> $a.Length 0 ``` -### One object +The following example shows that a variable that contains one object has a +**Count** and **Length** of 1. You can also use array indexing to access the +value of the object. ```powershell -$a = 4 -$a.Count -$a.Length -$a[0] -$a[-1] +PS> $a = 4 +PS> $a.Count +1 +PS> $a.Length +1 +PS> $a[0] +4 +PS> $a[-1] +4 ``` -```Output -1 +When you run a command that could return a collection or a single object, you +can use array indexing to access the value of the object without having to test +the **Count** or **Length** properties. However, if the result is a single +object (singleton), and that object has a **Count** or **Length** property, the +value of those properties belong to the singleton object and don't represent +the number of items in the collection. + +In the following example, the command returns a single string object. The +**Length** of that string is `4`. + +```powershell +PS> $result = 'one','two','three','four' | Where-Object {$_ -like 'f*'} +PS> $result.GetType().FullName +System.String +PS> $result +four +PS> $result.Count 1 +PS❯ $result.Length 4 +``` + +If you want `$result` to be an array of strings, you need to declare the +variable as an array. + +In this example, `$result` is an array of strings. The **Count** and **Length** +of the array is `1`, and the **Length** of the first element is `4`. + +```powershell +PS> [string[]]$result = 'one','two','three','four' | + Where-Object {$_ -like 'f*'} +PS> $result.GetType().FullName +System.String[] +PS> $result +four +PS> $result.Count +1 +PS> $result.Length +1 +PS> $result[0].Length 4 ``` diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Variables.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Variables.md index 934c65e87d0..7b09f2f2567 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Variables.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Variables.md @@ -1,7 +1,7 @@ --- description: Describes how variables store values that can be used in PowerShell. Locale: en-US -ms.date: 08/28/2021 +ms.date: 03/07/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_variables?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Variables @@ -26,7 +26,7 @@ such as `$a`, `$process`, or `$my_var`. Variable names aren't case-sensitive, and can include spaces and special characters. But, variable names that include special characters and spaces are difficult to use and should be avoided. For more information, see -[Variable names that include special characters](#variable-names-that-include-special-characters). +[Variable names that include special characters][01]. There are several different types of variables in PowerShell. @@ -44,7 +44,7 @@ There are several different types of variables in PowerShell. PowerShell installation directory. For more information, a list, and a description of the automatic variables, - see [about_Automatic_Variables](about_Automatic_Variables.md). + see [about_Automatic_Variables][04]. - Preference variables: Preference variables store user preferences for PowerShell. These variables are created by PowerShell and are populated with @@ -53,7 +53,7 @@ There are several different types of variables in PowerShell. in the session history. For more information, a list, and a description of the preference variables, - see [about_Preference_Variables](about_Preference_Variables.md). + see [about_Preference_Variables][08]. ## Working with variables @@ -142,8 +142,7 @@ Clear-Variable -Name MyVariable $MyVariable = $null ``` -To delete the variable, use [Remove-Variable](xref:Microsoft.PowerShell.Utility.Remove-Variable) -or [Remove-Item](xref:Microsoft.PowerShell.Management.Remove-Item). +To delete the variable, use [Remove-Variable][16] or [Remove-Item][14]. ```powershell Remove-Variable -Name MyVariable @@ -168,7 +167,7 @@ $i,$j = 10, "red", $true # $i is 10, $j is [object[]], Length 2 ``` For more detailed information, see the **Assigning multiple variables** section -of [about_Assignment_Operators](about_assignment_operators.md#assigning-multiple-variables). +of [about_Assignment_Operators][03]. ## Types of variables @@ -181,8 +180,7 @@ a particular type of object. A single variable can even contain a collection, or array, of different types of objects at the same time. The data type of a variable is determined by the .NET types of the values of -the variable. To view a variable's object type, use -[Get-Member](xref:Microsoft.PowerShell.Utility.Get-Member). +the variable. To view a variable's object type, use [Get-Member][15]. For example: @@ -212,8 +210,8 @@ $number = "Hello" ``` ```Output -Cannot convert value "Hello" to type "System.Int32". Error: "Input string was - not in a correct format." +Cannot convert value "Hello" to type "System.Int32". Error: "Input string +was not in a correct format." At line:1 char:1 + $number = "Hello" + ~~~~~~~~~~~~~~~~~ @@ -264,7 +262,7 @@ If the variable name and dollar sign are enclosed in single quotation (`'`) marks, the variable name is used in the expression. For more information about using quotation marks in PowerShell, see -[about_Quoting_Rules](about_Quoting_Rules.md). +[about_Quoting_Rules][10]. This example gets the value of the `$PROFILE` variable, which is the path to the PowerShell user profile file in the PowerShell console. @@ -324,7 +322,7 @@ Alphanumeric variable names can contain these characters: - Question mark (`?`) character. The following list contains the Unicode category descriptions. For more -information, see [UnicodeCategory](/dotnet/api/system.globalization.unicodecategory). +information, see [UnicodeCategory][17]. - **Lu** - UppercaseLetter - **Ll** - LowercaseLetter @@ -347,7 +345,7 @@ Special character variable names can contain these characters: PowerShell has reserved variables such as `$$`, `$?`, `$^`, and `$_` that contain alphanumeric and special characters. For more information, see -[about_Automatic_Variables](about_automatic_variables.md). +[about_Automatic_Variables][04]. For example, the following command creates the variable named `save-items`. The curly braces (`{}`) are needed because variable name includes a hyphen (`-`) @@ -391,7 +389,7 @@ By default, variables are only available in the scope in which they're created. For example, a variable that you create in a function is available only within the function. A variable that you create in a script is available only within the script. If you dot-source the script, the variable is added to the current -scope. For more information, see [about_Scopes](about_Scopes.md). +scope. For more information, see [about_Scopes][12]. You can use a scope modifier to change the default scope of the variable. The following expression creates a variable named `Computers`. The variable has a @@ -405,7 +403,7 @@ For any script or command that executes out of session, you need the `Using` scope modifier to embed variable values from the calling session scope, so that out of session code can access them. -For more information, see [about_Remote_Variables](about_Remote_Variables.md). +For more information, see [about_Remote_Variables][11]. ## Saving variables @@ -424,7 +422,7 @@ $VerbosePreference = "Continue" You can add this command to your PowerShell profile by opening the `$PROFILE` file in a text editor, such as **notepad.exe**. For more information about -PowerShell profiles, see [about_Profiles](about_Profiles.md). +PowerShell profiles, see [about_Profiles][09]. ## The Variable: drive @@ -469,16 +467,15 @@ Get-Help Variable ## Variable syntax with provider paths You can prefix a provider path with the dollar (`$`) sign, and access the -content of any provider that implements the -[IContentCmdletProvider](/dotnet/api/system.management.automation.provider.icontentcmdletprovider) +content of any provider that implements the [IContentCmdletProvider][18] interface. The following built-in PowerShell providers support this notation: -- [about_Environment_Provider](about_Environment_Provider.md) -- [about_Variable_Provider](about_Variable_Provider.md) -- [about_Function_Provider](about_Function_Provider.md) -- [about_Alias_Provider](about_Alias_Provider.md) +- [about_Environment_Provider][05] +- [about_Variable_Provider][13] +- [about_Function_Provider][07] +- [about_Alias_Provider][02] ## The variable cmdlets @@ -496,8 +493,8 @@ To get help for a specific cmdlet, type: Get-Help ``` -| Cmdlet Name | Description | -| --------------- | ------------------------------------------ | +| Cmdlet Name | Description | +| ----------------- | ------------------------------------------ | | `Clear-Variable` | Deletes the value of a variable. | | `Get-Variable` | Gets the variables in the current console. | | `New-Variable` | Creates a new variable. | @@ -506,10 +503,30 @@ Get-Help ## See also -- [about_Automatic_Variables](about_Automatic_Variables.md) -- [about_Environment_Variables](about_Environment_Variables.md) -- [about_Preference_Variables](about_Preference_Variables.md) -- [about_Profiles](about_Profiles.md) -- [about_Quoting_Rules](about_Quoting_Rules.md) -- [about_Remote_Variables](about_Remote_Variables.md) -- [about_Scopes](about_Scopes.md) +- [about_Automatic_Variables][04] +- [about_Environment_Variables][06] +- [about_Preference_Variables][08] +- [about_Profiles][09] +- [about_Quoting_Rules][10] +- [about_Remote_Variables][11] +- [about_Scopes][12] + + +[01]: #variable-names-that-include-special-characters +[02]: about_Alias_Provider.md +[03]: about_assignment_operators.md#assigning-multiple-variables +[04]: about_Automatic_Variables.md +[05]: about_Environment_Provider.md +[06]: about_Environment_Variables.md +[07]: about_Function_Provider.md +[08]: about_Preference_Variables.md +[09]: about_Profiles.md +[10]: about_Quoting_Rules.md +[11]: about_Remote_Variables.md +[12]: about_Scopes.md +[13]: about_Variable_Provider.md +[14]: xref:Microsoft.PowerShell.Management.Remove-Item +[15]: xref:Microsoft.PowerShell.Utility.Get-Member +[16]: xref:Microsoft.PowerShell.Utility.Remove-Variable +[17]: xref:System.Globalization.UnicodeCategory +[18]: xref:System.Management.Automation.Provider.IContentCmdletProvider diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Arrays.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Arrays.md index 817222b4829..1794b7a45d9 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Arrays.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Arrays.md @@ -1,7 +1,7 @@ --- description: Describes arrays, which are data structures designed to store collections of items. Locale: en-US -ms.date: 01/17/2023 +ms.date: 03/07/2024 no-loc: [Count, Length, LongLength, Rank, ForEach, Clear, Default, First, Last, SkipUntil, Until, Split, Tuple] online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_arrays?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 @@ -889,35 +889,73 @@ Beginning in Windows PowerShell 3.0, a collection of zero or one object has the object. This feature helps you to avoid scripting errors that occur when a command that expects a collection gets fewer than two items. -The following examples demonstrate this feature. - -### Zero objects +The following example shows that a variable that contains no objects has a +**Count** and **Length** of 0. ```powershell -$a = $null -$a.Count -$a.Length -``` - -```Output +PS> $a = $null +PS> $a.Count 0 +PS> $a.Length 0 ``` -### One object +The following example shows that a variable that contains one object has a +**Count** and **Length** of 1. You can also use array indexing to access the +value of the object. ```powershell -$a = 4 -$a.Count -$a.Length -$a[0] -$a[-1] +PS> $a = 4 +PS> $a.Count +1 +PS> $a.Length +1 +PS> $a[0] +4 +PS> $a[-1] +4 ``` -```Output -1 +When you run a command that could return a collection or a single object, you +can use array indexing to access the value of the object without having to test +the **Count** or **Length** properties. However, if the result is a single +object (singleton), and that object has a **Count** or **Length** property, the +value of those properties belong to the singleton object and don't represent +the number of items in the collection. + +In the following example, the command returns a single string object. The +**Length** of that string is `4`. + +```powershell +PS> $result = 'one','two','three','four' | Where-Object {$_ -like 'f*'} +PS> $result.GetType().FullName +System.String +PS> $result +four +PS> $result.Count 1 +PS❯ $result.Length 4 +``` + +If you want `$result` to be an array of strings, you need to declare the +variable as an array. + +In this example, `$result` is an array of strings. The **Count** and **Length** +of the array is `1`, and the **Length** of the first element is `4`. + +```powershell +PS> [string[]]$result = 'one','two','three','four' | + Where-Object {$_ -like 'f*'} +PS> $result.GetType().FullName +System.String[] +PS> $result +four +PS> $result.Count +1 +PS> $result.Length +1 +PS> $result[0].Length 4 ``` diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Variables.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Variables.md index e1db6c8d954..e563bf0cdfc 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Variables.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Variables.md @@ -1,7 +1,7 @@ --- description: Describes how variables store values that can be used in PowerShell. Locale: en-US -ms.date: 08/28/2021 +ms.date: 03/07/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_variables?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Variables @@ -26,7 +26,7 @@ such as `$a`, `$process`, or `$my_var`. Variable names aren't case-sensitive, and can include spaces and special characters. But, variable names that include special characters and spaces are difficult to use and should be avoided. For more information, see -[Variable names that include special characters](#variable-names-that-include-special-characters). +[Variable names that include special characters][01]. There are several different types of variables in PowerShell. @@ -44,7 +44,7 @@ There are several different types of variables in PowerShell. PowerShell installation directory. For more information, a list, and a description of the automatic variables, - see [about_Automatic_Variables](about_Automatic_Variables.md). + see [about_Automatic_Variables][04]. - Preference variables: Preference variables store user preferences for PowerShell. These variables are created by PowerShell and are populated with @@ -53,7 +53,7 @@ There are several different types of variables in PowerShell. in the session history. For more information, a list, and a description of the preference variables, - see [about_Preference_Variables](about_Preference_Variables.md). + see [about_Preference_Variables][08]. ## Working with variables @@ -142,8 +142,7 @@ Clear-Variable -Name MyVariable $MyVariable = $null ``` -To delete the variable, use [Remove-Variable](xref:Microsoft.PowerShell.Utility.Remove-Variable) -or [Remove-Item](xref:Microsoft.PowerShell.Management.Remove-Item). +To delete the variable, use [Remove-Variable][16] or [Remove-Item][14]. ```powershell Remove-Variable -Name MyVariable @@ -168,7 +167,7 @@ $i,$j = 10, "red", $true # $i is 10, $j is [object[]], Length 2 ``` For more detailed information, see the **Assigning multiple variables** section -of [about_Assignment_Operators](about_assignment_operators.md#assigning-multiple-variables). +of [about_Assignment_Operators][03]. ## Types of variables @@ -181,8 +180,7 @@ a particular type of object. A single variable can even contain a collection, or array, of different types of objects at the same time. The data type of a variable is determined by the .NET types of the values of -the variable. To view a variable's object type, use -[Get-Member](xref:Microsoft.PowerShell.Utility.Get-Member). +the variable. To view a variable's object type, use [Get-Member][15]. For example: @@ -212,8 +210,8 @@ $number = "Hello" ``` ```Output -Cannot convert value "Hello" to type "System.Int32". Error: "Input string was - not in a correct format." +Cannot convert value "Hello" to type "System.Int32". Error: "Input string +was not in a correct format." At line:1 char:1 + $number = "Hello" + ~~~~~~~~~~~~~~~~~ @@ -264,7 +262,7 @@ If the variable name and dollar sign are enclosed in single quotation (`'`) marks, the variable name is used in the expression. For more information about using quotation marks in PowerShell, see -[about_Quoting_Rules](about_Quoting_Rules.md). +[about_Quoting_Rules][10]. This example gets the value of the `$PROFILE` variable, which is the path to the PowerShell user profile file in the PowerShell console. @@ -324,7 +322,7 @@ Alphanumeric variable names can contain these characters: - Question mark (`?`) character. The following list contains the Unicode category descriptions. For more -information, see [UnicodeCategory](/dotnet/api/system.globalization.unicodecategory). +information, see [UnicodeCategory][17]. - **Lu** - UppercaseLetter - **Ll** - LowercaseLetter @@ -347,7 +345,7 @@ Special character variable names can contain these characters: PowerShell has reserved variables such as `$$`, `$?`, `$^`, and `$_` that contain alphanumeric and special characters. For more information, see -[about_Automatic_Variables](about_automatic_variables.md). +[about_Automatic_Variables][04]. For example, the following command creates the variable named `save-items`. The curly braces (`{}`) are needed because variable name includes a hyphen (`-`) @@ -391,7 +389,7 @@ By default, variables are only available in the scope in which they're created. For example, a variable that you create in a function is available only within the function. A variable that you create in a script is available only within the script. If you dot-source the script, the variable is added to the current -scope. For more information, see [about_Scopes](about_Scopes.md). +scope. For more information, see [about_Scopes][12]. You can use a scope modifier to change the default scope of the variable. The following expression creates a variable named `Computers`. The variable has a @@ -405,7 +403,7 @@ For any script or command that executes out of session, you need the `Using` scope modifier to embed variable values from the calling session scope, so that out of session code can access them. -For more information, see [about_Remote_Variables](about_Remote_Variables.md). +For more information, see [about_Remote_Variables][11]. ## Saving variables @@ -424,7 +422,7 @@ $VerbosePreference = "Continue" You can add this command to your PowerShell profile by opening the `$PROFILE` file in a text editor, such as **notepad.exe**. For more information about -PowerShell profiles, see [about_Profiles](about_Profiles.md). +PowerShell profiles, see [about_Profiles][09]. ## The Variable: drive @@ -469,16 +467,15 @@ Get-Help Variable ## Variable syntax with provider paths You can prefix a provider path with the dollar (`$`) sign, and access the -content of any provider that implements the -[IContentCmdletProvider](/dotnet/api/system.management.automation.provider.icontentcmdletprovider) +content of any provider that implements the [IContentCmdletProvider][18] interface. The following built-in PowerShell providers support this notation: -- [about_Environment_Provider](about_Environment_Provider.md) -- [about_Variable_Provider](about_Variable_Provider.md) -- [about_Function_Provider](about_Function_Provider.md) -- [about_Alias_Provider](about_Alias_Provider.md) +- [about_Environment_Provider][05] +- [about_Variable_Provider][13] +- [about_Function_Provider][07] +- [about_Alias_Provider][02] ## The variable cmdlets @@ -496,8 +493,8 @@ To get help for a specific cmdlet, type: Get-Help ``` -| Cmdlet Name | Description | -| --------------- | ------------------------------------------ | +| Cmdlet Name | Description | +| ----------------- | ------------------------------------------ | | `Clear-Variable` | Deletes the value of a variable. | | `Get-Variable` | Gets the variables in the current console. | | `New-Variable` | Creates a new variable. | @@ -506,10 +503,30 @@ Get-Help ## See also -- [about_Automatic_Variables](about_Automatic_Variables.md) -- [about_Environment_Variables](about_Environment_Variables.md) -- [about_Preference_Variables](about_Preference_Variables.md) -- [about_Profiles](about_Profiles.md) -- [about_Quoting_Rules](about_Quoting_Rules.md) -- [about_Remote_Variables](about_Remote_Variables.md) -- [about_Scopes](about_Scopes.md) +- [about_Automatic_Variables][04] +- [about_Environment_Variables][06] +- [about_Preference_Variables][08] +- [about_Profiles][09] +- [about_Quoting_Rules][10] +- [about_Remote_Variables][11] +- [about_Scopes][12] + + +[01]: #variable-names-that-include-special-characters +[02]: about_Alias_Provider.md +[03]: about_assignment_operators.md#assigning-multiple-variables +[04]: about_Automatic_Variables.md +[05]: about_Environment_Provider.md +[06]: about_Environment_Variables.md +[07]: about_Function_Provider.md +[08]: about_Preference_Variables.md +[09]: about_Profiles.md +[10]: about_Quoting_Rules.md +[11]: about_Remote_Variables.md +[12]: about_Scopes.md +[13]: about_Variable_Provider.md +[14]: xref:Microsoft.PowerShell.Management.Remove-Item +[15]: xref:Microsoft.PowerShell.Utility.Get-Member +[16]: xref:Microsoft.PowerShell.Utility.Remove-Variable +[17]: xref:System.Globalization.UnicodeCategory +[18]: xref:System.Management.Automation.Provider.IContentCmdletProvider diff --git a/reference/docfx.json b/reference/docfx.json index 41878104d56..041d103201a 100644 --- a/reference/docfx.json +++ b/reference/docfx.json @@ -56,15 +56,17 @@ "7.3/**/*": "managed-reference", "7.4/**/*": "managed-reference", "7.5/**/*": "managed-reference", + "docs-conceptual/community/contributing/**/*.md": "contributor-guide", "docs-conceptual/**/*.md": "conceptual", "docs-conceptual/dev-cross-plat/**/*.md": "reference", "docs-conceptual/developer/**/*.md": "reference", - "docs-conceptual/lang-spec/**/*.md": "reference", + "docs-conceptual/lang-spec/**/*.md": "language-reference", "docs-conceptual/learn/*.md": "tutorial", "docs-conceptual/learn/deep-dives/*.md": "tutorial", "docs-conceptual/learn/ps101/*.md": "conceptual", "docs-conceptual/learn/remoting/*.md": "tutorial", - "docs-conceptual/samples/**/*.md": "sample" + "docs-conceptual/samples/**/*.md": "sample", + "docs-conceptual/whats-new/**/*.md": "whats-new" }, "products": { "5.1/**/*": [ diff --git a/reference/docs-conceptual/community/contributing/editorial-checklist.md b/reference/docs-conceptual/community/contributing/editorial-checklist.md index 74850d1e9e7..acbc011cd46 100644 --- a/reference/docs-conceptual/community/contributing/editorial-checklist.md +++ b/reference/docs-conceptual/community/contributing/editorial-checklist.md @@ -1,7 +1,6 @@ --- description: This is a summarized list of rules for editing PowerShell documentation. ms.date: 11/16/2022 -ms.topic: conceptual title: Editorial checklist --- # Editor's checklist diff --git a/reference/docs-conceptual/community/contributing/file-an-issue.md b/reference/docs-conceptual/community/contributing/file-an-issue.md index be6e070ed31..d54d2c8ed4a 100644 --- a/reference/docs-conceptual/community/contributing/file-an-issue.md +++ b/reference/docs-conceptual/community/contributing/file-an-issue.md @@ -1,7 +1,6 @@ --- description: This article explains how to give feedback about the PowerShell documentation. ms.date: 07/26/2022 -ms.topic: conceptual title: How to file a PowerShell-Docs issue --- # How to file a PowerShell-Docs issue diff --git a/reference/docs-conceptual/community/contributing/general-markdown.md b/reference/docs-conceptual/community/contributing/general-markdown.md index 8ca682c6e4f..6d084dfaec7 100644 --- a/reference/docs-conceptual/community/contributing/general-markdown.md +++ b/reference/docs-conceptual/community/contributing/general-markdown.md @@ -1,7 +1,6 @@ --- description: This article provides specific guidance for using Markdown in our documentation. ms.date: 07/26/2022 -ms.topic: conceptual title: Markdown best practices --- # Markdown best practices diff --git a/reference/docs-conceptual/community/contributing/get-started-writing.md b/reference/docs-conceptual/community/contributing/get-started-writing.md index 16e87571a0a..dd7edecdf66 100644 --- a/reference/docs-conceptual/community/contributing/get-started-writing.md +++ b/reference/docs-conceptual/community/contributing/get-started-writing.md @@ -1,7 +1,6 @@ --- description: This article is an overview of how to get started as a contributor to the PowerShell documentation. ms.date: 07/26/2022 -ms.topic: conceptual title: Get started contributing to PowerShell documentation --- # Get started contributing to PowerShell documentation diff --git a/reference/docs-conceptual/community/contributing/hackathons.md b/reference/docs-conceptual/community/contributing/hackathons.md index 87e4c8adcd9..f099eafbb4c 100644 --- a/reference/docs-conceptual/community/contributing/hackathons.md +++ b/reference/docs-conceptual/community/contributing/hackathons.md @@ -1,7 +1,6 @@ --- description: This article describes how we manage and support hack-a-thon events like Hacktoberfest. ms.date: 10/04/2022 -ms.topic: conceptual title: Hacktoberfest and other hack-a-thon events --- # Hacktoberfest and other hack-a-thon events diff --git a/reference/docs-conceptual/community/contributing/labelling-in-github.md b/reference/docs-conceptual/community/contributing/labelling-in-github.md index b8d8285d4bd..f92c2d84c57 100644 --- a/reference/docs-conceptual/community/contributing/labelling-in-github.md +++ b/reference/docs-conceptual/community/contributing/labelling-in-github.md @@ -1,7 +1,6 @@ --- description: This article explains how the PowerShell-Docs team uses labels in GitHub. ms.date: 12/16/2022 -ms.topic: conceptual title: Labelling in GitHub --- diff --git a/reference/docs-conceptual/community/contributing/managing-issues.md b/reference/docs-conceptual/community/contributing/managing-issues.md index d87110aeaa6..9f494199dcb 100644 --- a/reference/docs-conceptual/community/contributing/managing-issues.md +++ b/reference/docs-conceptual/community/contributing/managing-issues.md @@ -1,7 +1,6 @@ --- description: This article explains how the PowerShell-Docs team manages issues. ms.date: 11/09/2022 -ms.topic: conceptual title: How we manage issues --- # How we manage issues diff --git a/reference/docs-conceptual/community/contributing/managing-pull-requests.md b/reference/docs-conceptual/community/contributing/managing-pull-requests.md index 502ad3873d8..e883da16857 100644 --- a/reference/docs-conceptual/community/contributing/managing-pull-requests.md +++ b/reference/docs-conceptual/community/contributing/managing-pull-requests.md @@ -1,7 +1,6 @@ --- description: This article explains how the PowerShell-Docs team manages pull requests. ms.date: 07/25/2022 -ms.topic: conceptual title: How we manage pull requests --- # Managing pull requests diff --git a/reference/docs-conceptual/community/contributing/overview.md b/reference/docs-conceptual/community/contributing/overview.md index a8cb059ede6..60ae6bdc45c 100644 --- a/reference/docs-conceptual/community/contributing/overview.md +++ b/reference/docs-conceptual/community/contributing/overview.md @@ -1,7 +1,6 @@ --- description: This article outlines the steps required to contribute to the PowerShell documentation. ms.date: 07/25/2022 -ms.topic: conceptual title: Contributing to PowerShell documentation --- # Contributing to PowerShell documentation diff --git a/reference/docs-conceptual/community/contributing/powershell-style-guide.md b/reference/docs-conceptual/community/contributing/powershell-style-guide.md index 6b6dfb75558..40aaffa87a6 100644 --- a/reference/docs-conceptual/community/contributing/powershell-style-guide.md +++ b/reference/docs-conceptual/community/contributing/powershell-style-guide.md @@ -1,7 +1,6 @@ --- description: This article provides the rules of style for writing PowerShell documentation. ms.date: 11/14/2022 -ms.topic: conceptual title: PowerShell-Docs style guide --- # PowerShell-Docs style guide diff --git a/reference/docs-conceptual/community/contributing/product-terminology.md b/reference/docs-conceptual/community/contributing/product-terminology.md index 9c1e3b5f0a1..0549b934957 100644 --- a/reference/docs-conceptual/community/contributing/product-terminology.md +++ b/reference/docs-conceptual/community/contributing/product-terminology.md @@ -1,8 +1,6 @@ --- description: This article contains guidelines for the proper use of product names and terms. ms.date: 11/14/2022 -ms.topic: conceptual -ms.custom: has-azure-ad-ps-ref title: Product terminology and branding guidelines --- # Product terminology and branding guidelines diff --git a/reference/docs-conceptual/community/contributing/pull-requests.md b/reference/docs-conceptual/community/contributing/pull-requests.md index 0c844d868bd..b2abc7b5e41 100644 --- a/reference/docs-conceptual/community/contributing/pull-requests.md +++ b/reference/docs-conceptual/community/contributing/pull-requests.md @@ -1,7 +1,6 @@ --- description: This article explains how to submit pull requests to the PowerShell-Docs repository. ms.date: 07/26/2022 -ms.topic: conceptual title: How to submit pull requests --- # How to submit pull requests diff --git a/reference/docs-conceptual/community/contributing/quality-improvements.md b/reference/docs-conceptual/community/contributing/quality-improvements.md index cd19ba76d33..a025e556068 100644 --- a/reference/docs-conceptual/community/contributing/quality-improvements.md +++ b/reference/docs-conceptual/community/contributing/quality-improvements.md @@ -2,7 +2,6 @@ description: >- This article describes the process for contributing quality improvements to the documentation. ms.date: 06/28/2023 -ms.topic: conceptual title: Contributing quality improvements --- diff --git a/reference/docs-conceptual/community/contributing/using-github-codespaces.md b/reference/docs-conceptual/community/contributing/using-github-codespaces.md index 6c5c14eeef1..4796bb96fa6 100644 --- a/reference/docs-conceptual/community/contributing/using-github-codespaces.md +++ b/reference/docs-conceptual/community/contributing/using-github-codespaces.md @@ -3,7 +3,6 @@ description: >- This article describes the process for contributing to the documentation using GitHub Codespaces as an authoring environment. ms.date: 05/10/2023 -ms.topic: conceptual title: Contribute using GitHub Codespaces --- diff --git a/reference/docs-conceptual/developer/cmdlet/strongly-encouraged-development-guidelines.md b/reference/docs-conceptual/developer/cmdlet/strongly-encouraged-development-guidelines.md index e9cc9d2883f..37f743041e8 100644 --- a/reference/docs-conceptual/developer/cmdlet/strongly-encouraged-development-guidelines.md +++ b/reference/docs-conceptual/developer/cmdlet/strongly-encouraged-development-guidelines.md @@ -1,7 +1,7 @@ --- description: Strongly Encouraged Development Guidelines ms.date: 10/05/2021 -ms.topic: reference +ms.topic: design-pattern title: Strongly Encouraged Development Guidelines --- # Strongly Encouraged Development Guidelines diff --git a/reference/docs-conceptual/discover-powershell.md b/reference/docs-conceptual/discover-powershell.md index e8da5a7ef60..f33c170728b 100644 --- a/reference/docs-conceptual/discover-powershell.md +++ b/reference/docs-conceptual/discover-powershell.md @@ -1,7 +1,7 @@ --- description: Learn what PowerShell is and some essential commands used to discover more about PowerShell. ms.date: 01/31/2023 -ms.reviewer: sewhee +ms.topic: overview title: Discover PowerShell --- diff --git a/reference/docs-conceptual/install/PowerShell-Support-Lifecycle.md b/reference/docs-conceptual/install/PowerShell-Support-Lifecycle.md index 79a55771d54..60ce24a04d7 100644 --- a/reference/docs-conceptual/install/PowerShell-Support-Lifecycle.md +++ b/reference/docs-conceptual/install/PowerShell-Support-Lifecycle.md @@ -1,6 +1,7 @@ --- description: Details the policies governing support for PowerShell ms.date: 02/23/2024 +ms.topic: lifecycle title: PowerShell Support Lifecycle --- # PowerShell Support Lifecycle diff --git a/reference/docs-conceptual/overview.md b/reference/docs-conceptual/overview.md index eacaf8f97fa..5f85c28f4a8 100644 --- a/reference/docs-conceptual/overview.md +++ b/reference/docs-conceptual/overview.md @@ -1,6 +1,7 @@ --- description: This article is an introduction to the PowerShell scripting environment and its features. ms.date: 06/28/2023 +ms.topic: overview title: What is PowerShell? --- diff --git a/reference/docs-conceptual/powershell-commands.md b/reference/docs-conceptual/powershell-commands.md index aedf82c067a..4296c14c34f 100644 --- a/reference/docs-conceptual/powershell-commands.md +++ b/reference/docs-conceptual/powershell-commands.md @@ -1,6 +1,7 @@ --- description: Commands for PowerShell are known as cmdlets (pronounced command-lets) ms.date: 11/16/2022 +ms.topic: overview title: What is a PowerShell command? --- # What is a PowerShell command (cmdlet)? diff --git a/reference/docs-conceptual/toc.yml b/reference/docs-conceptual/toc.yml index e331a5c026e..fd47f54d948 100644 --- a/reference/docs-conceptual/toc.yml +++ b/reference/docs-conceptual/toc.yml @@ -6,6 +6,8 @@ items: items: - name: What is PowerShell? href: overview.md + - name: What is Windows PowerShell? + href: what-is-windows-powershell.md - name: What is a PowerShell command? href: powershell-commands.md - name: Discover PowerShell @@ -325,8 +327,6 @@ items: href: windows-powershell/ise/object-model/the-powershelltab-object.md - name: Other useful scripting objects href: windows-powershell/ise/object-model/other-useful-scripting-objects.md - - name: What is Windows PowerShell? - href: windows-powershell/overview.md - name: Starting Windows PowerShell href: windows-powershell/starting-windows-powershell.md - name: Windows Management Framework (WMF) diff --git a/reference/docs-conceptual/what-is-windows-powershell.md b/reference/docs-conceptual/what-is-windows-powershell.md new file mode 100644 index 00000000000..5f896d5fbda --- /dev/null +++ b/reference/docs-conceptual/what-is-windows-powershell.md @@ -0,0 +1,37 @@ +--- +description: This article explains the difference between Windows PowerShell and PowerShell. +ms.date: 03/07/2024 +ms.topic: overview +title: What is Windows PowerShell? +--- +# What is Windows PowerShell? + +_**Windows PowerShell**_ and _**PowerShell**_ are two separate products. + +- _**Windows PowerShell**_ is the version of PowerShell that ships in Windows. This version of + PowerShell uses the full .NET Framework, which only runs on Windows. The latest version is Windows + PowerShell 5.1. Microsoft is no longer updating Windows PowerShell with new features. Support for + Windows PowerShell is tied to the version of Windows you are using. + +- _**PowerShell**_ is built on the new versions of .NET instead of the .NET Framework and runs on + Windows, Linux, and macOS. Support for PowerShell is based on the version of .NET that it was + built on. For more information about the support lifecycle for PowerShell, see the + [PowerShell support lifecycle][02] documentation. + +## Further reading + +- For a more detailed explanation of the differences between Windows PowerShell and PowerShell, see + [Differences between Windows PowerShell 5.1 and PowerShell 7.x][03]. +- For information about migrating from Windows PowerShell to PowerShell, see + [Migrating from Windows PowerShell 5.1 to PowerShell 7][04]. +- For more information about previous versions of Windows PowerShell, see + [Previous versions of PowerShell][05]. +- For more information about the terminology used in PowerShell documentation, see + [Product terminology and branding guidelines][01]. + + +[01]: ./community/contributing/product-terminology.md +[02]: ./install/PowerShell-Support-Lifecycle.md +[03]: ./whats-new/differences-from-windows-powershell.md +[04]: ./whats-new/Migrating-from-Windows-PowerShell-51-to-PowerShell-7.md +[05]: /previous-versions/powershell/scripting/overview diff --git a/reference/docs-conceptual/windows-powershell/ise/Accessibility-in-Windows-PowerShell-ISE.md b/reference/docs-conceptual/windows-powershell/ise/Accessibility-in-Windows-PowerShell-ISE.md index 47d236cb231..ed6307b2872 100644 --- a/reference/docs-conceptual/windows-powershell/ise/Accessibility-in-Windows-PowerShell-ISE.md +++ b/reference/docs-conceptual/windows-powershell/ise/Accessibility-in-Windows-PowerShell-ISE.md @@ -1,6 +1,7 @@ --- description: This topic describes the accessibility features of Windows PowerShell Integrated Scripting Environment (ISE) that you might find helpful. ms.date: 12/19/2019 +ms.topic: ui-reference title: Accessibility in Windows PowerShell ISE --- diff --git a/reference/docs-conceptual/windows-powershell/ise/Exploring-the-Windows-PowerShell-ISE.md b/reference/docs-conceptual/windows-powershell/ise/Exploring-the-Windows-PowerShell-ISE.md index f3f48e2f64a..341877966f6 100644 --- a/reference/docs-conceptual/windows-powershell/ise/Exploring-the-Windows-PowerShell-ISE.md +++ b/reference/docs-conceptual/windows-powershell/ise/Exploring-the-Windows-PowerShell-ISE.md @@ -2,7 +2,7 @@ description: This article is an overview of the features of the Windows PowerShell ISE ms.custom: ISE-F1-page ms.date: 05/04/2023 -ms.topic: conceptual +ms.topic: ui-reference title: Exploring the Windows PowerShell ISE --- diff --git a/reference/docs-conceptual/windows-powershell/ise/How-to-Create-a-PowerShell-Tab-in-Windows-PowerShell-ISE.md b/reference/docs-conceptual/windows-powershell/ise/How-to-Create-a-PowerShell-Tab-in-Windows-PowerShell-ISE.md index 99162df04d0..c24c64e9ee3 100644 --- a/reference/docs-conceptual/windows-powershell/ise/How-to-Create-a-PowerShell-Tab-in-Windows-PowerShell-ISE.md +++ b/reference/docs-conceptual/windows-powershell/ise/How-to-Create-a-PowerShell-Tab-in-Windows-PowerShell-ISE.md @@ -1,6 +1,7 @@ --- description: Tabs in the Windows PowerShell Integrated Scripting Environment (ISE) allow you to simultaneously create and use several execution environments within the same application. Each PowerShell tab corresponds to a separate execution environment or session. ms.date: 10/07/2021 +ms.topic: ui-reference title: How to Create a PowerShell Tab in Windows PowerShell ISE --- diff --git a/reference/docs-conceptual/windows-powershell/ise/How-to-Debug-Scripts-in-Windows-PowerShell-ISE.md b/reference/docs-conceptual/windows-powershell/ise/How-to-Debug-Scripts-in-Windows-PowerShell-ISE.md index ba00ee8bafc..a793e6e084c 100644 --- a/reference/docs-conceptual/windows-powershell/ise/How-to-Debug-Scripts-in-Windows-PowerShell-ISE.md +++ b/reference/docs-conceptual/windows-powershell/ise/How-to-Debug-Scripts-in-Windows-PowerShell-ISE.md @@ -1,6 +1,7 @@ --- description: This article describes how to debug scripts on a local computer by using the Windows PowerShell ISE visual debugging features. ms.date: 10/07/2021 +ms.topic: ui-reference title: How to Debug Scripts in Windows PowerShell ISE --- diff --git a/reference/docs-conceptual/windows-powershell/ise/How-to-Use-the-Console-Pane-in-the-Windows-PowerShell-ISE.md b/reference/docs-conceptual/windows-powershell/ise/How-to-Use-the-Console-Pane-in-the-Windows-PowerShell-ISE.md index 4b436770d17..b05869b8f30 100644 --- a/reference/docs-conceptual/windows-powershell/ise/How-to-Use-the-Console-Pane-in-the-Windows-PowerShell-ISE.md +++ b/reference/docs-conceptual/windows-powershell/ise/How-to-Use-the-Console-Pane-in-the-Windows-PowerShell-ISE.md @@ -1,6 +1,7 @@ --- description: How to Use the Console Pane in the Windows PowerShell ISE ms.date: 01/02/2020 +ms.topic: ui-reference title: How to Use the Console Pane in the Windows PowerShell ISE --- diff --git a/reference/docs-conceptual/windows-powershell/ise/Introducing-the-Windows-PowerShell-ISE.md b/reference/docs-conceptual/windows-powershell/ise/Introducing-the-Windows-PowerShell-ISE.md index 6253583733b..a7da093393e 100644 --- a/reference/docs-conceptual/windows-powershell/ise/Introducing-the-Windows-PowerShell-ISE.md +++ b/reference/docs-conceptual/windows-powershell/ise/Introducing-the-Windows-PowerShell-ISE.md @@ -1,6 +1,7 @@ --- description: The PowerShell ISE is a host application for Windows PowerShell that allows you to run commands and write, test, and debug scripts in a single Windows-based graphic user interface. ms.date: 10/07/2021 +ms.topic: overview title: Introducing the Windows PowerShell ISE --- diff --git a/reference/docs-conceptual/windows-powershell/ise/Keyboard-Shortcuts-for-the-Windows-PowerShell-ISE.md b/reference/docs-conceptual/windows-powershell/ise/Keyboard-Shortcuts-for-the-Windows-PowerShell-ISE.md index 7b7531eba62..2f9600e55bd 100644 --- a/reference/docs-conceptual/windows-powershell/ise/Keyboard-Shortcuts-for-the-Windows-PowerShell-ISE.md +++ b/reference/docs-conceptual/windows-powershell/ise/Keyboard-Shortcuts-for-the-Windows-PowerShell-ISE.md @@ -1,6 +1,7 @@ --- description: This article is a list of the keyboard shortcuts used in the PowerShell ISE. ms.date: 03/04/2024 +ms.topic: ui-reference title: Keyboard Shortcuts for the Windows PowerShell ISE --- diff --git a/reference/docs-conceptual/windows-powershell/overview.md b/reference/docs-conceptual/windows-powershell/overview.md deleted file mode 100644 index 58bf5342278..00000000000 --- a/reference/docs-conceptual/windows-powershell/overview.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -description: This article explains the difference between Windows PowerShell and PowerShell. -ms.date: 11/03/2023 -ms.topic: conceptual -title: What is Windows PowerShell? ---- -# What is Windows PowerShell? - -Windows PowerShell and PowerShell are two separate products. - -_Windows PowerShell_ is the version of PowerShell that ships in Windows. This version of PowerShell -uses the full .NET Framework, which only runs on Windows. The latest version is Windows PowerShell -5.1. Microsoft is no longer updating Windows PowerShell with new features. Support for Windows -PowerShell is tied to the version of Windows you are using. - -_PowerShell_ is built on the new versions of .NET instead of the .NET Framework and runs on Windows, -Linux, and macOS. Support for PowerShell is based on the version of .NET that it was built on. For -more information about the support lifecycle for PowerShell, see the -[PowerShell support lifecycle][01] documentation. - -## Further reading - -- For a more detailed explanation of the differences between Windows PowerShell and PowerShell, see - [Differences between Windows PowerShell 5.1 and PowerShell 7.x][02]. -- For information about migrating from Windows PowerShell to PowerShell, see - [Migrating from Windows PowerShell 5.1 to PowerShell 7][03]. -- For more information about previous versions of Windows PowerShell, see - [Previous versions of PowerShell][04]. - - -[01]: ../install/PowerShell-Support-Lifecycle.md -[02]: ../whats-new/differences-from-windows-powershell.md -[03]: ../whats-new/Migrating-from-Windows-PowerShell-51-to-PowerShell-7.md -[04]: /previous-versions/powershell/scripting/overview diff --git a/reference/docs-conceptual/windows-powershell/wmf-overview.md b/reference/docs-conceptual/windows-powershell/wmf-overview.md index 063e590a239..4e866776c7b 100644 --- a/reference/docs-conceptual/windows-powershell/wmf-overview.md +++ b/reference/docs-conceptual/windows-powershell/wmf-overview.md @@ -1,6 +1,7 @@ --- description: WMF is a prerequisite for Windows PowerShell. This articles shows the history of WMF versions and provides information about how to find and install WMF. ms.date: 11/03/2023 +ms.topic: overview title: Windows Management Framework (WMF) ---