Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ the user creates:

```powershell
function PSConsoleHostReadLine {
$inputFile = Join-Path $env:TEMP PSConsoleHostReadLine
$inputFile = Join-Path $Env:TEMP PSConsoleHostReadLine
Set-Content $inputFile "PS > "

# Notepad opens. Enter your command in it, save the file, and then exit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ properties and values was more complicated. Originally, you had to use
example:

```powershell
PS> $object1 = New-Object -TypeName PSObject
PS> $object1 = New-Object -TypeName psobject
PS> Add-Member -InputObject $object1 -MemberType NoteProperty -Name one -Value 1
PS> Add-Member -InputObject $object1 -MemberType NoteProperty -Name two -Value 2
PS> $object1 | Get-Member
Expand All @@ -50,7 +50,7 @@ Later, you could use the **Property** parameter of `New-Object` to pass a
**Hashtable** containing the members and values. For example:

```powershell
PS> $object2 = New-Object -TypeName PSObject -Property @{one=1; two=2}
PS> $object2 = New-Object -TypeName psobject -Property @{one=1; two=2}
PS> $object2 | Get-Member

TypeName: System.Management.Automation.PSCustomObject
Expand Down Expand Up @@ -191,11 +191,11 @@ have subtle side effects.
- Wrapped objects match their original type and the `[psobject]` type.

```powershell
PS> 1 -is [Int32]
PS> 1 -is [int32]
True
PS> 1 -is [psobject]
False
PS> ([psobject] 1) -is [Int32]
PS> ([psobject] 1) -is [int32]
True
PS> ([psobject] 1) -is [psobject]
True
Expand Down Expand Up @@ -248,7 +248,7 @@ When that hashtable is cast to a `[pscustomobject]`, the case of the name of
first key is used, but that value of the last matching key name is used.

```powershell
[PSCustomObject]$OrderedHashTable
[pscustomobject]$OrderedHashTable
```

```Output
Expand All @@ -266,7 +266,7 @@ Attempting to access these members returns `$null`.
For example:

```powershell
PS> $object = [PSCustomObject]@{key = 'value'}
PS> $object = [pscustomobject]@{key = 'value'}
PS> $object

key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ parameters that take input from the pipeline.
function Write-JsonLog {
[CmdletBinding()]
param(
[parameter(ValueFromPipelineByPropertyName)]
[Parameter(ValueFromPipelineByPropertyName)]
[string]$Message
)
begin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Variable expressions carry the value of the variable they reference:

```powershell
$x
$script:path
$Script:path
```

Operators combine other expressions for evaluation:
Expand Down Expand Up @@ -352,7 +352,7 @@ arguments to the executable. You can use this tool to verify that you have
properly escaped the characters in your arguments.

```powershell
TestExe -echoargs """""${env:ProgramFiles(x86)}\Microsoft\\"""""
TestExe -echoargs """""${Env:ProgramFiles(x86)}\Microsoft\\"""""
TestExe -echoargs """""C:\Program Files (x86)\Microsoft\\"""""
TestExe -echoargs --% ""\""C:\Program Files (x86)\Microsoft\\""
TestExe -echoargs --% """C:\Program Files (x86)\Microsoft\\""
Expand Down Expand Up @@ -390,7 +390,7 @@ Unlike the stop-parsing (`--%`) token, any values following the `--` token can
be interpreted as expressions by PowerShell.

```powershell
Write-Output -- -InputObject $env:PROCESSOR_ARCHITECTURE
Write-Output -- -InputObject $Env:PROCESSOR_ARCHITECTURE
```

```Output
Expand Down
22 changes: 11 additions & 11 deletions reference/5.1/Microsoft.PowerShell.Core/About/about_Pipelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Get-Process notepad | Stop-Process
The first command uses the `Get-Process` cmdlet to get an object representing
the Notepad process. It uses a pipeline operator (`|`) to send the process
object to the `Stop-Process` cmdlet, which stops the Notepad process. Notice
that the `Stop-Process` command doesn't have a **Name** or **ID** parameter to
that the `Stop-Process` command doesn't have a **Name** or **Id** parameter to
specify the process, because the specified process is submitted through the
pipeline.

Expand All @@ -60,9 +60,9 @@ displays the name and length of each file in a table.

```powershell
Get-ChildItem -Path *.txt |
Where-Object {$_.length -gt 10000} |
Sort-Object -Property length |
Format-Table -Property name, length
Where-Object {$_.Length -gt 10000} |
Sort-Object -Property Length |
Format-Table -Property Name, Length
```

This pipeline consists of four commands in the specified order. The following
Expand All @@ -73,7 +73,7 @@ command in the pipeline.
Get-ChildItem -Path *.txt
| (FileInfo objects for *.txt)
V
Where-Object {$_.length -gt 10000}
Where-Object {$_.Length -gt 10000}
| (FileInfo objects for *.txt)
| ( Length > 10000 )
V
Expand All @@ -82,7 +82,7 @@ Sort-Object -Property Length
| ( Length > 10000 )
| ( Sorted by length )
V
Format-Table -Property name, length
Format-Table -Property Name, Length
| (FileInfo objects for *.txt)
| ( Length > 10000 )
| ( Sorted by length )
Expand Down Expand Up @@ -110,7 +110,7 @@ Get-Service wmi | Start-Service
```

For another example, you can pipe the output of `Get-Item` or `Get-ChildItem`
within the PowerShell registry provider to the `New-ItemProperty` cmdlet. This
within the PowerShell Registry provider to the `New-ItemProperty` cmdlet. This
example adds a new registry entry, **NoOfEmployees**, with a value of **8124**,
to the **MyCompany** registry key.

Expand All @@ -126,11 +126,11 @@ how to sort all the processes on the computer by the number of open handles in
each process.

```powershell
Get-Process | Sort-Object -Property handles
Get-Process | Sort-Object -Property Handles
```

You can pipe objects to the formatting, export, and output cmdlets, such as
`Format-List`, `Format-Table`, `Export-Clixml`, `Export-CSV`, and `Out-File`.
`Format-List`, `Format-Table`, `Export-Clixml`, `Export-Csv`, and `Out-File`.

This example shows how to use the `Format-List` cmdlet to display a list of
properties for a process object.
Expand Down Expand Up @@ -391,7 +391,7 @@ use that to count the number of processes running on the computer.
For example,

```powershell
(Get-Process).count
(Get-Process).Count
```

It's important to remember that objects sent down the pipeline are delivered
Expand Down Expand Up @@ -564,7 +564,7 @@ enhances readability.
- [about_Objects][05]
- [about_Parameters][06]
- [about_Command_Syntax][03]
- [about_ForEach][04]
- [about_Foreach][04]

<!-- link references -->
[02]: #investigating-pipeline-errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ PowerShell includes the following environment variables that store user
preferences. For more information about these environment variables, see
[about_Environment_Variables][30].

- `$env:PSExecutionPolicyPreference`
- `$env:PSModulePath`
- `$Env:PSExecutionPolicyPreference`
- `$Env:PSModulePath`

> [!NOTE]
> Changes to preference variables apply only in the scope they are made
Expand Down Expand Up @@ -549,7 +549,7 @@ ObjectNotFound: (C:\nofile.txt:String) [Get-ChildItem], ItemNotFoundException
This example demonstrates that the value of `$ErrorView` only affects the error
display. It doesn't change the structure of the error object that's stored in
the `$Error` automatic variable. For information about the `$Error` automatic
variable, see [about_automatic_variables][28].
variable, see [about_Automatic_Variables][28].

The following command takes the **ErrorRecord** object associated with the most
recent error in the error array, **element 0**, and formats the properties of
Expand Down Expand Up @@ -739,14 +739,14 @@ To enable a **Log*Event**, type the variable with a value of `$true`, for
example:

```powershell
$LogCommandLifeCycleEvent = $true
$LogCommandLifecycleEvent = $true
```

To disable an event type, type the variable with a value of `$false`, for
example:

```powershell
$LogCommandLifeCycleEvent = $false
$LogCommandLifecycleEvent = $false
```

The events that you enable are effective only for the current PowerShell
Expand All @@ -766,7 +766,7 @@ value is **4096** and that should be enough for most uses. You can adjust
To count the aliases on your system, type:

```powershell
(Get-Alias).count
(Get-Alias).Count
```

## $MaximumDriveCount
Expand All @@ -782,7 +782,7 @@ providers and appear as drives, such as the `Alias:` and `HKLM:` drives.
To count the aliases on your system, type:

```powershell
(Get-PSDrive).count
(Get-PSDrive).Count
```

## $MaximumErrorCount
Expand All @@ -801,7 +801,7 @@ To count the errors on your system, use the `$Error` array's **Count**
property.

```powershell
$Error.count
$Error.Count
```

To display a specific error, use the `[0]` array notation to see the most
Expand Down Expand Up @@ -1016,7 +1016,7 @@ try {
$buffer = [byte[]]::new(1024)
$read = $inputStream.Read($buffer, 0, $buffer.Length)
$actual = [byte[]]::new($read)
[Array]::Copy($buffer, $actual, $read)
[array]::Copy($buffer, $actual, $read)
Format-Hex -InputObject $actual
} finally {
$inputStream.Dispose()
Expand Down Expand Up @@ -1093,16 +1093,16 @@ Specifies the default email server that's used to send email messages. This
preference variable is used by cmdlets that send email, such as the
[Send-MailMessage][49] cmdlet.

## $PSModuleAutoloadingPreference
## $PSModuleAutoLoadingPreference

Enables and disables automatic importing of modules in the session. The
`$PSModuleAutoloadingPreference` variable doesn't exist by default. The default
`$PSModuleAutoLoadingPreference` variable doesn't exist by default. The default
behavior when the variable isn't defined is the same as
`$PSModuleAutoloadingPreference = 'All'`.
`$PSModuleAutoLoadingPreference = 'All'`.

To automatically import a module, get or use a command contained in the module.

The `$PSModuleAutoloadingPreference` variable takes one of the
The `$PSModuleAutoLoadingPreference` variable takes one of the
[`PSModuleAutoLoadingPreference`][58] enumeration values:

- `All`: Modules are imported automatically on first-use.
Expand Down Expand Up @@ -1700,7 +1700,7 @@ At line:1 char:1

## See also

- [about_automatic_variables][28]
- [about_Automatic_Variables][28]
- [about_CommonParameters][29]
- [about_Environment_Variables][30]
- [about_Profiles][36]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,9 @@ Here are a few suggestions to get you started.
### Add a function that lists aliases for any cmdlet

```powershell
function Get-CmdletAlias ($cmdletname) {
function Get-CmdletAlias ($cmdletName) {
Get-Alias |
Where-Object -FilterScript {$_.Definition -like "$cmdletname"} |
Where-Object -FilterScript {$_.Definition -like "$cmdletName"} |
Format-Table -Property Definition, Name -AutoSize
}
```
Expand All @@ -216,9 +216,9 @@ function Get-CmdletAlias ($cmdletname) {

```powershell
function CustomizeConsole {
$hosttime = (Get-ChildItem -Path $PSHOME\PowerShell.exe).CreationTime
$hostversion="$($Host.Version.Major)`.$($Host.Version.Minor)"
$Host.UI.RawUI.WindowTitle = "PowerShell $hostversion ($hosttime)"
$hostTime = (Get-ChildItem -Path $PSHOME\powershell.exe).CreationTime
$hostVersion="$($Host.Version.Major)`.$($Host.Version.Minor)"
$Host.UI.RawUI.WindowTitle = "PowerShell $hostVersion ($hostTime)"
Clear-Host
}
CustomizeConsole
Expand All @@ -227,8 +227,8 @@ CustomizeConsole
### Add a customized PowerShell prompt

```powershell
function Prompt {
$env:COMPUTERNAME + "\" + (Get-Location) + "> "
function prompt {
$Env:COMPUTERNAME + "\" + (Get-Location) + "> "
}
```

Expand Down
Loading