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 @@ -119,7 +119,7 @@ following example uses the first `CopyTo` method to copy the `Final.txt` file
to the `C:\Bin` directory.

```powershell
(Get-ChildItem c:\final.txt).CopyTo("c:\bin\final.txt")
(Get-ChildItem C:\final.txt).CopyTo("C:\bin\final.txt")
```

> [!NOTE]
Expand All @@ -138,7 +138,7 @@ The following example uses the second `CopyTo` method to copy the `Final.txt`
file to the `C:\Bin` directory, and to overwrite existing files.

```powershell
(Get-ChildItem c:\final.txt).CopyTo("c:\bin\final.txt", $true)
(Get-ChildItem C:\final.txt).CopyTo("C:\bin\final.txt", $true)
```

## Member-access enumeration
Expand Down Expand Up @@ -190,7 +190,7 @@ At line:1 char:12
l.Commands.GetProcessCommand
```

This example is functionally equivalent to using the `Foreach-Object` cmdlet to
This example is functionally equivalent to using the `ForEach-Object` cmdlet to
run the method on each object in the collection.

```powershell
Expand All @@ -203,7 +203,7 @@ Beginning in PowerShell 4.0, collection filtering using a method syntax is
supported. This allows use of two new methods when dealing with collections
`ForEach` and `Where`.

You can read more about these methods in [about_arrays](about_arrays.md)
You can read more about these methods in [about_Arrays](about_arrays.md)

## Calling a specific method when multiple overloads exist

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Allowed variables
- `$PSScriptRoot`
- `$PSEdition`
- `$EnabledExperimentalFeatures`
- Any environment variables, like `$ENV:TEMP`
- Any environment variables, like `$Env:TEMP`

For more information, see [about_Language_Modes][08].

Expand Down Expand Up @@ -1416,7 +1416,7 @@ For example, this manifest defines the **PublishedDate** key in
Cmdlets in the module can access this value with the `$MyInvocation` variable.

```powershell
Function Get-Stale {
function Get-Stale {
[CmdletBinding()]
param()

Expand All @@ -1428,7 +1428,7 @@ Function Get-Stale {
} catch {
# The date was set in the manifest, set to an invalid value, or
# the script module was directly imported without the manifest.
Throw "Unable to determine published date. Check the module manifest."
throw "Unable to determine published date. Check the module manifest."
}

if ($CurrentDate -gt $PublishedDate.AddDays(30)) {
Expand Down
20 changes: 10 additions & 10 deletions reference/5.1/Microsoft.PowerShell.Core/About/about_Modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ A module is a self-contained, reusable unit that can include cmdlets,
providers, functions, variables, and other resources. By default, PowerShell
automatically loads an installed module the first time you use a command from
the module. You can configure automatic module loading behavior using the
variable `$PSModuleAutoloadingPreference`. For more information, see
variable `$PSModuleAutoLoadingPreference`. For more information, see
[about_Preference_Variables][08].

You can also manually load or unload modules during a PowerShell session. To
Expand All @@ -49,7 +49,7 @@ to create PowerShell modules, see [Writing a PowerShell Module][02].

PowerShell stores modules in the following default locations:

- All users scope - `$env:ProgramFiles\WindowsPowerShell\Modules`
- All users scope - `$Env:ProgramFiles\WindowsPowerShell\Modules`
- Current user scope - `$HOME\Documents\WindowsPowerShell\Modules`
- Modules shipped with PowerShell - `$PSHOME\Modules`

Expand All @@ -64,15 +64,15 @@ Use the following command to create a `Modules` folder for the current user:
$folder = New-Item -Type Directory -Path $HOME\Documents\WindowsPowerShell\Modules
```

These locations are automatically included in the `$env:PSModulePath`
These locations are automatically included in the `$Env:PSModulePath`
environment variable. For more information about the default module locations,
see [about_PSModulePath][10].

## Module autoloading

The first time that you run a command from an installed module, PowerShell
automatically imports (loads) that module. The module must be stored in the
locations specified in the `$env:PSModulePath` environment variable.
locations specified in the `$Env:PSModulePath` environment variable.

Module autoloading allows you to use commands in a module without any setup or
profile configuration. Each of the following examples causes the **CimCmdlets**
Expand Down Expand Up @@ -103,7 +103,7 @@ modules that you might not need in your session.
## Manually import a module

Manually importing a module is required when a module isn't installed in the
locations specified by the `$env:PSModulePath` environment variable, or when
locations specified by the `$Env:PSModulePath` environment variable, or when
the module is provided as a standalone `.dll` or `.psm1` file, rather than a
packaged module.

Expand All @@ -127,7 +127,7 @@ session.
Import-Module BitsTransfer
```

To import a module that isn't in your `$env:PSModulePath`, use the fully
To import a module that isn't in your `$Env:PSModulePath`, use the fully
qualified path to the module folder. For example, to add the **TestCmdlets**
module in the `C:\ps-test` directory to your session, type:

Expand Down Expand Up @@ -187,7 +187,7 @@ For more information, see [PowerShellGet Overview][01].
You can manually install a module by copying the module contents from another
folder. That folder can be in another location on the local machine or
installed on another machine. To install a module manually, copy the entire
module folder into a new location included in your `$env:PSModulePath`.
module folder into a new location included in your `$Env:PSModulePath`.

In PowerShell use the `Copy-Item` cmdlet. For example, run the following
command to copy the `MyModule` folder from `C:\PSTest`:
Expand All @@ -210,16 +210,16 @@ Get-Module
```

The modules listed can include modules that were imported from any location,
not just from `$env:PSModulePath`.
not just from `$Env:PSModulePath`.

Use the following command to list modules that are installed in the
`$env:PSModulePath`:
`$Env:PSModulePath`:

```powershell
Get-Module -ListAvailable
```

This command gets all modules that are installed in `$env:PSModulePath`, not
This command gets all modules that are installed in `$Env:PSModulePath`, not
just the modules that are imported into the current session. This command
doesn't list modules that are installed in other locations.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@ PowerShell supports the following type accelerators:
| ----------- | -------------------- | -------------------------------- |
| `[byte]` | | Byte (unsigned) |
| `[sbyte]` | | Byte (signed) |
| `[Int16]` | | 16-bit integer |
| `[UInt16]` | | 16-bit integer (unsigned) |
| `[Int32]` | | 32-bit integer |
| `[int16]` | | 16-bit integer |
| `[uint16]` | | 16-bit integer (unsigned) |
| `[int32]` | | 32-bit integer |
| `[int]` | alias for `[int32]` | 32-bit integer |
| `[UInt32]` | | 32-bit integer (unsigned) |
| `[Int64]` | | 64-bit integer |
| `[uint32]` | | 32-bit integer (unsigned) |
| `[int64]` | | 64-bit integer |
| `[long]` | alias for `[int64]` | 64-bit integer |
| `[UInt64]` | | 64-bit integer (unsigned) |
| `[uint64]` | | 64-bit integer (unsigned) |
| `[bigint]` | | See [BigInteger Struct][bigint] |
| `[single]` | | Single precision floating point |
| `[float]` | alias for `[single]` | Single precision floating point |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ There are many ways to create objects, this list is not definitive:

- [New-Object][16]: Creates an instance of a .NET Framework object or COM
object.
- [Import-Csv][15] / [ConvertFrom-CSV][11]: Creates custom objects
- [Import-Csv][15] / [ConvertFrom-Csv][11]: Creates custom objects
(**PSCustomObject**) from the items defined as character separated values.
- [ConvertFrom-Json][12]: Creates custom objects defined in JavaScript Object
Notation (JSON).
Expand Down Expand Up @@ -173,17 +173,17 @@ the example section of the `Update-Help` cmdlet help topic.
```powershell
function Test-Object {
$ModuleName = "PSScheduledJob"
$HelpCulture = "en-us"
$HelpCulture = "en-US"
$HelpVersion = "3.1.0.0"
[PSCustomObject]@{
[pscustomobject]@{
"ModuleName"=$ModuleName
"UICulture"=$HelpCulture
"Version"=$HelpVersion
}
$ModuleName = "PSWorkflow"
$HelpCulture = "en-us"
$HelpCulture = "en-US"
$HelpVersion = "3.0.0.0"
[PSCustomObject]@{
[pscustomobject]@{
"ModuleName"=$ModuleName
"UICulture"=$HelpCulture
"Version"=$HelpVersion
Expand All @@ -198,8 +198,8 @@ table by default.
```Output
ModuleName UICulture Version
--------- --------- -------
PSScheduledJob en-us 3.1.0.0
PSWorkflow en-us 3.0.0.0
PSScheduledJob en-US 3.1.0.0
PSWorkflow en-US 3.0.0.0
```

Users can manage the properties of the custom objects just as they do with
Expand Down
10 changes: 5 additions & 5 deletions reference/5.1/Microsoft.PowerShell.Core/About/about_Objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,18 @@ The following example demonstrates how objects are passed from one
command to the next:

```powershell
Get-ChildItem C: | where { $_.PsIsContainer -eq $false } | Format-List
Get-ChildItem C: | where { $_.PSIsContainer -eq $false } | Format-List
```

The first command `Get-ChildItem C:` returns a file or directory object
for each item in the root directory of the file system. The file and
directory objects are passed down the pipeline to the second command.

The second command `where { $_.PsIsContainer -eq $false }` uses the
**PsIsContainer** property of all file system objects to select only
files, which have a value of False (`$false`) in their **PsIsContainer**
The second command `where { $_.PSIsContainer -eq $false }` uses the
**PSIsContainer** property of all file system objects to select only
files, which have a value of False (`$false`) in their **PSIsContainer**
property. Folders, which are containers and, thus, have a value of
True (`$true`) in their **PsIsContainer** property, are not selected.
True (`$true`) in their **PSIsContainer** property, are not selected.

The second command passes only the file objects to the third command
`Format-List`, which displays the file objects in a list.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ precedence.

The Operator column lists the operators. The Reference column lists the
PowerShell Help topic in which the operator is described. To display the topic,
type `get-help <topic-name>`.
type `Get-Help <topic-name>`.

| OPERATOR | REFERENCE |
| --------------------------- | ------------------------------------ |
Expand Down Expand Up @@ -66,7 +66,7 @@ and explicitly case-insensitive variants have the same precedence.
| `-like -notlike` | [about_Comparison_Operators][compare] |
| `-match -notmatch` | [about_Comparison_Operators][compare] |
| `-in -notIn` | [about_Comparison_Operators][compare] |
| `-contains -notContains` | [about_Comparison_Operators][compare] |
| `-contains -notcontains` | [about_Comparison_Operators][compare] |
| `-replace` | [about_Comparison_Operators][compare] |

The list resumes here with the following operators in precedence
Expand Down Expand Up @@ -110,13 +110,13 @@ The following example gets the read-only text files from the local directory
and saves them in the `$read_only` variable.

```powershell
$read_only = Get-ChildItem *.txt | Where-Object {$_.isReadOnly}
$read_only = Get-ChildItem *.txt | Where-Object {$_.IsReadOnly}
```

It is equivalent to the following example.

```powershell
$read_only = ( Get-ChildItem *.txt | Where-Object {$_.isReadOnly} )
$read_only = ( Get-ChildItem *.txt | Where-Object {$_.IsReadOnly} )
```

Because the pipeline operator (`|`) has a higher precedence than the assignment
Expand Down
20 changes: 10 additions & 10 deletions reference/5.1/Microsoft.PowerShell.Core/About/about_Operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ of command in a string expression.
PS> "Today is $(Get-Date)"
Today is 12/02/2019 13:15:20

PS> "Folder list: $((dir c:\ -dir).Name -join ', ')"
PS> "Folder list: $((dir C:\ -Dir).Name -join ', ')"
Folder list: Program Files, Program Files (x86), Users, Windows
```

Expand All @@ -243,7 +243,7 @@ True True Object[] System.Array

PS> $list.Count
20
PS> $list = @(Get-Service | Where-Object Status -eq Starting )
PS> $list = @(Get-Service | Where-Object Status -EQ Starting )
PS> $list.GetType()

IsPublic IsSerial Name BaseType
Expand Down Expand Up @@ -348,7 +348,7 @@ Converts or limits objects to the specified type. If the objects can't be
converted, PowerShell generates an error.

```powershell
[DateTime] '2/20/88' - [DateTime] '1/20/88' -eq [TimeSpan] '31'
[datetime] '2/20/88' - [datetime] '1/20/88' -eq [timespan] '31'
```

A cast can also be performed when a variable is assigned to using
Expand Down Expand Up @@ -378,7 +378,7 @@ for which no value has been given become variables with no value. However, the
automatic variable `$args` is preserved.

```powershell
. c:\scripts\sample.ps1 1 2 -Also:3
. C:\scripts\sample.ps1 1 2 -Also:3
```

> [!NOTE]
Expand Down Expand Up @@ -414,7 +414,7 @@ Enter the composite format string on the left side of the operator and the
objects to be formatted on the right side of the operator.

```powershell
"{0} {1,-10} {2:N}" -f 1,"hello",[math]::pi
"{0} {1,-10} {2:N}" -f 1,"hello",[Math]::PI
```

```Output
Expand Down Expand Up @@ -467,7 +467,7 @@ PS> $a[2, 1, 0]
```

```powershell
(Get-HotFix | Sort-Object installedOn)[-1]
(Get-HotFix | Sort-Object InstalledOn)[-1]
```

```powershell
Expand Down Expand Up @@ -576,9 +576,9 @@ Accesses the properties and methods of an object. The member name may be an
expression.

```powershell
$myProcess.peakWorkingSet
(Get-Process PowerShell).Kill()
'OS', 'Platform' | Foreach-Object { $PSVersionTable. $_ }
$myProcess.PeakWorkingSet
(Get-Process powershell).Kill()
'OS', 'Platform' | ForEach-Object { $PSVersionTable. $_ }
```

Starting PowerShell 3.0, when you use the operator on a list collection object
Expand All @@ -594,7 +594,7 @@ properties and methods of an object, use the Static parameter of the

```powershell
[datetime]::Now
'MinValue', 'MaxValue' | Foreach-Object { [int]:: $_ }
'MinValue', 'MaxValue' | ForEach-Object { [int]:: $_ }
```

## See also
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function Measure-Lines {

if ($Words) {
$wc = 0
foreach ($line in $content) { $wc += $line.split(' ').Length }
foreach ($line in $content) { $wc += $line.Split(' ').Length }
$result.Add('Words', $wc)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ As a result of the `Position` settings for these two parameters, you can use
any of the following commands:

```powershell
Get-ChildItem -Path c:\techdocs -Exclude *.ppt
Get-ChildItem c:\techdocs -Exclude *.ppt
Get-ChildItem -Exclude *.ppt -Path c:\techdocs
Get-ChildItem -Exclude *.ppt c:\techdocs
Get-ChildItem -Path C:\techdocs -Exclude *.ppt
Get-ChildItem C:\techdocs -Exclude *.ppt
Get-ChildItem -Exclude *.ppt -Path C:\techdocs
Get-ChildItem -Exclude *.ppt C:\techdocs
```

If you were to include another positional parameter without including the
Expand Down Expand Up @@ -237,7 +237,7 @@ information about common parameters, see

## See also

- [about_Command_syntax](about_Command_syntax.md)
- [about_Command_Syntax](about_Command_Syntax.md)
- [about_Comment_Based_Help](about_Comment_Based_Help.md)
- [about_Functions_Advanced](about_Functions_Advanced.md)
- [about_Parameters_Default_Values](about_Parameters_Default_Values.md)
Expand Down
Loading