Skip to content

Commit e745f6b

Browse files
authored
Merge pull request #8266 from MicrosoftDocs/staging
10/27 PM Publish
2 parents e661141 + c5fec71 commit e745f6b

File tree

5 files changed

+115
-23
lines changed

5 files changed

+115
-23
lines changed

reference/5.1/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Describes variables that store state information for PowerShell. These variables are created and maintained by PowerShell.
33
Locale: en-US
4-
ms.date: 08/24/2021
4+
ms.date: 10/27/2021
55
no-loc: [Reset, Current, Background, Blink, Bold, Foreground, Formatting, Hidden, Italic, Reset, Reverse, Underline]
66
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_automatic_variables?view=powershell-5.1&WT.mc_id=ps-gethelp
77
schema: 2.0.0
@@ -561,11 +561,34 @@ and change the current loop iteration. For more information, see
561561

562562
### $this
563563

564-
In a script block that defines a script property or script method, the `$this`
565-
variable refers to the object that is being extended.
564+
The `$this` variable is used in script blocks that extend classes to refer to
565+
the instance of the class itself.
566566

567-
In a custom class, the `$this` variable refers to the class object itself
568-
allowing access to properties and methods defined in the class.
567+
PowerShell's Extensible Type System (ETS) allows you to add properties to
568+
classes using script blocks. In a script block that defines a script property
569+
or script method, the `$this` variable refers to an instance of object of the
570+
class that is being extended. For example, PowerShell uses ETS to add the
571+
**BaseName** property to the **FileInfo** class.
572+
573+
```powershell
574+
PS> Get-ChildItem .\README.md | Get-Member BaseName | Format-List
575+
576+
TypeName : System.IO.FileInfo
577+
Name : BaseName
578+
MemberType : ScriptProperty
579+
Definition : System.Object BaseName {get=if ($this.Extension.Length -gt 0){$this.Name.Remove($this.Name.Length -
580+
$this.Extension.Length)}else{$this.Name};}
581+
```
582+
583+
For more information, see [about_Types.ps1xml](./about_Types.ps1xml.md).
584+
585+
In a PowerShell class, the `$this` variable refers to the instance object of
586+
the class itself, allowing access to properties and methods defined in the
587+
class. For more information, see [about_Classes](about_Classes.md).
588+
589+
The `$this` variable is also used by .NET event classes that take script blocks
590+
as delegates for the event handler. In this scenario, `$this` represents the
591+
object originating the event, known as the event sender.
569592

570593
### $true
571594

reference/7.0/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Describes variables that store state information for PowerShell. These variables are created and maintained by PowerShell.
33
Locale: en-US
4-
ms.date: 08/24/2021
4+
ms.date: 10/27/2021
55
no-loc: [Reset, Current, Background, Blink, Bold, Foreground, Formatting, Hidden, Italic, Reset, Reverse, Underline]
66
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_automatic_variables?view=powershell-7&WT.mc_id=ps-gethelp
77
schema: 2.0.0
@@ -592,11 +592,34 @@ and change the current loop iteration. For more information, see
592592

593593
### $this
594594

595-
In a script block that defines a script property or script method, the `$this`
596-
variable refers to the object that is being extended.
595+
The `$this` variable is used in script blocks that extend classes to refer to
596+
the instance of the class itself.
597597

598-
In a custom class, the `$this` variable refers to the class object itself
599-
allowing access to properties and methods defined in the class.
598+
PowerShell's Extensible Type System (ETS) allows you to add properties to
599+
classes using script blocks. In a script block that defines a script property
600+
or script method, the `$this` variable refers to an instance of object of the
601+
class that is being extended. For example, PowerShell uses ETS to add the
602+
**BaseName** property to the **FileInfo** class.
603+
604+
```powershell
605+
PS> Get-ChildItem .\README.md | Get-Member BaseName | Format-List
606+
607+
TypeName : System.IO.FileInfo
608+
Name : BaseName
609+
MemberType : ScriptProperty
610+
Definition : System.Object BaseName {get=if ($this.Extension.Length -gt 0){$this.Name.Remove($this.Name.Length -
611+
$this.Extension.Length)}else{$this.Name};}
612+
```
613+
614+
For more information, see [about_Types.ps1xml](./about_Types.ps1xml.md).
615+
616+
In a PowerShell class, the `$this` variable refers to the instance object of
617+
the class itself, allowing access to properties and methods defined in the
618+
class. For more information, see [about_Classes](about_Classes.md).
619+
620+
The `$this` variable is also used by .NET event classes that take script blocks
621+
as delegates for the event handler. In this scenario, `$this` represents the
622+
object originating the event, known as the event sender.
600623

601624
### $true
602625

reference/7.1/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Describes variables that store state information for PowerShell. These variables are created and maintained by PowerShell.
33
Locale: en-US
4-
ms.date: 08/24/2021
4+
ms.date: 10/27/2021
55
no-loc: [Reset, Current, Background, Blink, Bold, Foreground, Formatting, Hidden, Italic, Reset, Reverse, Underline]
66
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_automatic_variables?view=powershell-7.1&WT.mc_id=ps-gethelp
77
schema: 2.0.0
@@ -592,11 +592,34 @@ and change the current loop iteration. For more information, see
592592

593593
### $this
594594

595-
In a script block that defines a script property or script method, the `$this`
596-
variable refers to the object that is being extended.
595+
The `$this` variable is used in script blocks that extend classes to refer to
596+
the instance of the class itself.
597597

598-
In a custom class, the `$this` variable refers to the class object itself
599-
allowing access to properties and methods defined in the class.
598+
PowerShell's Extensible Type System (ETS) allows you to add properties to
599+
classes using script blocks. In a script block that defines a script property
600+
or script method, the `$this` variable refers to an instance of object of the
601+
class that is being extended. For example, PowerShell uses ETS to add the
602+
**BaseName** property to the **FileInfo** class.
603+
604+
```powershell
605+
PS> Get-ChildItem .\README.md | Get-Member BaseName | Format-List
606+
607+
TypeName : System.IO.FileInfo
608+
Name : BaseName
609+
MemberType : ScriptProperty
610+
Definition : System.Object BaseName {get=if ($this.Extension.Length -gt 0){$this.Name.Remove($this.Name.Length -
611+
$this.Extension.Length)}else{$this.Name};}
612+
```
613+
614+
For more information, see [about_Types.ps1xml](./about_Types.ps1xml.md).
615+
616+
In a PowerShell class, the `$this` variable refers to the instance object of
617+
the class itself, allowing access to properties and methods defined in the
618+
class. For more information, see [about_Classes](about_Classes.md).
619+
620+
The `$this` variable is also used by .NET event classes that take script blocks
621+
as delegates for the event handler. In this scenario, `$this` represents the
622+
object originating the event, known as the event sender.
600623

601624
### $true
602625

reference/7.2/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Describes variables that store state information for PowerShell. These variables are created and maintained by PowerShell.
33
Locale: en-US
4-
ms.date: 08/24/2021
4+
ms.date: 10/27/2021
55
no-loc: [Reset, Current, Background, Blink, Bold, Foreground, Formatting, Hidden, Italic, Reset, Reverse, Underline]
66
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_automatic_variables?view=powershell-7.2&WT.mc_id=ps-gethelp
77
schema: 2.0.0
@@ -835,11 +835,34 @@ and change the current loop iteration. For more information, see
835835

836836
### $this
837837

838-
In a script block that defines a script property or script method, the `$this`
839-
variable refers to the object that is being extended.
838+
The `$this` variable is used in script blocks that extend classes to refer to
839+
the instance of the class itself.
840840

841-
In a custom class, the `$this` variable refers to the class object itself
842-
allowing access to properties and methods defined in the class.
841+
PowerShell's Extensible Type System (ETS) allows you to add properties to
842+
classes using script blocks. In a script block that defines a script property
843+
or script method, the `$this` variable refers to an instance of object of the
844+
class that is being extended. For example, PowerShell uses ETS to add the
845+
**BaseName** property to the **FileInfo** class.
846+
847+
```powershell
848+
PS> Get-ChildItem .\README.md | Get-Member BaseName | Format-List
849+
850+
TypeName : System.IO.FileInfo
851+
Name : BaseName
852+
MemberType : ScriptProperty
853+
Definition : System.Object BaseName {get=if ($this.Extension.Length -gt 0){$this.Name.Remove($this.Name.Length -
854+
$this.Extension.Length)}else{$this.Name};}
855+
```
856+
857+
For more information, see [about_Types.ps1xml](./about_Types.ps1xml.md).
858+
859+
In a PowerShell class, the `$this` variable refers to the instance object of
860+
the class itself, allowing access to properties and methods defined in the
861+
class. For more information, see [about_Classes](about_Classes.md).
862+
863+
The `$this` variable is also used by .NET event classes that take script blocks
864+
as delegates for the event handler. In this scenario, `$this` represents the
865+
object originating the event, known as the event sender.
843866

844867
### $true
845868

reference/docs-conceptual/install/Installing-PowerShell-on-Windows.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,11 @@ PowerShell Microsoft.PowerShell 7.1.5.0 winget
137137
Powershell Preview Microsoft.PowerShell.Preview 7.2.0.10 winget
138138
```
139139

140-
Install a version of PowerShell using the `--exact` parameter
140+
Install Powershell or Powershell Preview using the `id` parameter
141141

142142
```powershell
143-
winget install --name PowerShell --exact --source winget
144-
winget install --name PowerShell-Preview --exact --source winget
143+
winget install --id Microsoft.Powershell --source winget
144+
winget install --id Microsoft.Powershell.Preview --source winget
145145
```
146146

147147
## <a id="msstore" />Installing from the Microsoft Store

0 commit comments

Comments
 (0)