Skip to content

Commit 28240ce

Browse files
authored
Merge pull request #11727 from MicrosoftDocs/main
1/23/2025 PM Publish
2 parents 36c3d02 + ef1a978 commit 28240ce

File tree

254 files changed

+2074
-1826
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

254 files changed

+2074
-1826
lines changed

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

Lines changed: 40 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -40,28 +40,27 @@ The aliases have no child items.
4040
The **Alias** provider supports the following cmdlets, which are covered
4141
in this article.
4242

43-
- [Get-Location](xref:Microsoft.PowerShell.Management.Get-Location)
44-
- [Set-Location](xref:Microsoft.PowerShell.Management.Set-Location)
45-
- [Get-Item](xref:Microsoft.PowerShell.Management.Get-Item)
46-
- [New-Item](xref:Microsoft.PowerShell.Management.New-Item)
47-
- [Remove-Item](xref:Microsoft.PowerShell.Management.Remove-Item)
48-
- [Clear-Item](xref:Microsoft.PowerShell.Management.Clear-Item)
43+
- [Get-Location][01]
44+
- [Set-Location][02]
45+
- [Get-Item][03]
46+
- [New-Item][04]
47+
- [Remove-Item][05]
48+
- [Clear-Item][06]
4949

5050
PowerShell includes a set of cmdlets that are designed to view and to change
5151
aliases. When you use **Alias** cmdlets, you do not need to specify the
5252
`Alias:` drive in the name. This article does not cover working with **Alias**
5353
cmdlets.
5454

55-
- [Export-Alias](xref:Microsoft.PowerShell.Utility.Export-Alias)
56-
- [Get-Alias](xref:Microsoft.PowerShell.Utility.Get-Alias)
57-
- [Import-Alias](xref:Microsoft.PowerShell.Utility.Import-Alias)
58-
- [New-Alias](xref:Microsoft.PowerShell.Utility.New-Alias)
59-
- [Set-Alias](xref:Microsoft.PowerShell.Utility.Set-Alias)
55+
- [Export-Alias][07]
56+
- [Get-Alias][08]
57+
- [Import-Alias][09]
58+
- [New-Alias][10]
59+
- [Set-Alias][11]
6060

6161
## Types exposed by this provider
6262

63-
Each alias is an instance of the
64-
[System.Management.Automation.AliasInfo](/dotnet/api/system.management.automation.aliasinfo)
63+
Each alias is an instance of the [System.Management.Automation.AliasInfo][12]
6564
class.
6665

6766
## Navigating the Alias drive
@@ -87,11 +86,8 @@ path.
8786
> [!NOTE]
8887
> PowerShell uses aliases to allow you a familiar way to work with provider
8988
> paths. Commands such as `dir` and `ls` are now aliases for
90-
> [Get-ChildItem](xref:Microsoft.PowerShell.Management.Get-ChildItem), `cd` is
91-
> an alias for
92-
> [Set-Location](xref:Microsoft.PowerShell.Management.Set-Location). and `pwd`
93-
> is an alias for
94-
> [Get-Location](xref:Microsoft.PowerShell.Management.Get-Location).
89+
> [Get-ChildItem][13], `cd` is an alias for [Set-Location][02], and `pwd` is an
90+
> alias for [Get-Location][01].
9591
9692
### Displaying the Contents of the Alias: drive
9793

@@ -198,7 +194,7 @@ cmdlet. The `-Options` parameter is available in `Set-Item` when you use it
198194
with the **Alias** or **Function** provider.
199195

200196
```powershell
201-
Set-Item -Path Alias:dir -Options "AllScope,ReadOnly"
197+
Set-Item -Path Alias:dir -Options "AllScope, ReadOnly"
202198
```
203199

204200
### Change an aliases referenced command
@@ -293,8 +289,8 @@ Determines the value of the **Options** property of an alias.
293289

294290
#### Cmdlets supported
295291

296-
- [New-Item](xref:Microsoft.PowerShell.Management.New-Item)
297-
- [Set-Item](xref:Microsoft.PowerShell.Management.Set-Item)
292+
- [New-Item][04]
293+
- [Set-Item][14]
298294

299295
## Using the pipeline
300296

@@ -309,10 +305,8 @@ Beginning in Windows PowerShell 3.0, you can get customized help topics for
309305
provider cmdlets that explain how those cmdlets behave in a file system drive.
310306

311307
To get the help topics that are customized for the file system drive, run a
312-
[Get-Help](xref:Microsoft.PowerShell.Core.Get-Help) command in a file system
313-
drive or use the `-Path` parameter of
314-
[Get-Help](xref:Microsoft.PowerShell.Core.Get-Help) to specify a file system
315-
drive.
308+
[Get-Help][15] command in a file system drive or use the `-Path` parameter of
309+
[Get-Help][15] to specify a file system drive.
316310

317311
```powershell
318312
Get-Help Get-ChildItem
@@ -324,5 +318,24 @@ Get-Help Get-ChildItem -Path alias:
324318

325319
## See also
326320

327-
- [about_Aliases](about_Aliases.md)
328-
- [about_Providers](about_Providers.md)
321+
- [about_Aliases][16]
322+
- [about_Providers][17]
323+
324+
<!-- External links -->
325+
[01]: xref:Microsoft.PowerShell.Management.Get-Location
326+
[02]: xref:Microsoft.PowerShell.Management.Set-Location
327+
[03]: xref:Microsoft.PowerShell.Management.Get-Item
328+
[04]: xref:Microsoft.PowerShell.Management.New-Item
329+
[05]: xref:Microsoft.PowerShell.Management.Remove-Item
330+
[06]: xref:Microsoft.PowerShell.Management.Clear-Item
331+
[07]: xref:Microsoft.PowerShell.Utility.Export-Alias
332+
[08]: xref:Microsoft.PowerShell.Utility.Get-Alias
333+
[09]: xref:Microsoft.PowerShell.Utility.Import-Alias
334+
[10]: xref:Microsoft.PowerShell.Utility.New-Alias
335+
[11]: xref:Microsoft.PowerShell.Utility.Set-Alias
336+
[12]: /dotnet/api/system.management.automation.aliasinfo
337+
[13]: xref:Microsoft.PowerShell.Management.Get-ChildItem
338+
[14]: xref:Microsoft.PowerShell.Management.Set-Item
339+
[15]: xref:Microsoft.PowerShell.Core.Get-Help
340+
[16]: about_Aliases.md
341+
[17]: about_Providers.md

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ in the current session, type:
127127
Get-Alias
128128
```
129129

130-
To get particular aliases, use the Name parameter of the `Get-Alias` cmdlet. For
131-
example, to get aliases that begin with "p", type:
130+
To get particular aliases, use the Name parameter of the `Get-Alias` cmdlet.
131+
For example, to get aliases that begin with "p", type:
132132

133133
```powershell
134134
Get-Alias -Name p*

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

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ title: about_Arithmetic_Operators
99
# about_Arithmetic_Operators
1010

1111
## Short description
12+
1213
Describes the operators that perform arithmetic in PowerShell.
1314

1415
## Long description
@@ -202,7 +203,7 @@ result without losing precision. For example:
202203
(2 + 3.1).GetType().FullName
203204
```
204205

205-
```output
206+
```Output
206207
5.1
207208
System.Int32
208209
System.Double
@@ -216,7 +217,7 @@ is widened to accommodate the result, as in the following example:
216217
(512MB * 512MB).GetType().FullName
217218
```
218219

219-
```output
220+
```Output
220221
System.Int32
221222
System.Double
222223
```
@@ -226,10 +227,10 @@ following example, the negative value can't be cast to an unsigned integer, and
226227
the unsigned integer is too large to be cast to `Int32`:
227228

228229
```powershell
229-
([int32]::minvalue + [uint32]::maxvalue).gettype().fullname
230+
([int32]::minvalue + [uint32]::maxvalue).GetType().FullName
230231
```
231232

232-
```output
233+
```Output
233234
System.Int64
234235
```
235236

@@ -268,8 +269,8 @@ PS> [ulong](9223372036854775807 + 2)
268269
9223372036854775808
269270
```
270271

271-
Defining the larger value as `[ulong]` first avoids the problem and produces the
272-
correct result.
272+
Defining the larger value as `[ulong]` first avoids the problem and produces
273+
the correct result.
273274

274275
```powershell
275276
PS> 9223372036854775807ul + 2
@@ -326,7 +327,7 @@ $b = "A","B","C"
326327
$a + $b
327328
```
328329

329-
```output
330+
```Output
330331
1
331332
2
332333
3
@@ -389,7 +390,7 @@ $hash2 = @{c1="Server01"; c2="Server02"}
389390
$hash1 + $hash2
390391
```
391392

392-
```output
393+
```Output
393394
Name Value
394395
---- -----
395396
c2 Server02
@@ -408,7 +409,7 @@ $hash2 = @{c1="Server01"; c="Server02"}
408409
$hash1 + $hash2
409410
```
410411

411-
```output
412+
```Output
412413
OperationStopped:
413414
Line |
414415
3 | $hash1 + $hash2
@@ -426,7 +427,7 @@ $array2 = $array1 + $hash1
426427
$array2
427428
```
428429

429-
```output
430+
```Output
430431
0
431432
Hello World
432433
@@ -447,7 +448,7 @@ However, you can't add any other type to a hash table.
447448
$hash1 + 2
448449
```
449450

450-
```output
451+
```Output
451452
InvalidOperation: A hash table can only be added to another hash table.
452453
```
453454

@@ -462,7 +463,7 @@ $array = @()
462463
$array
463464
```
464465

465-
```output
466+
```Output
466467
0
467468
1
468469
2
@@ -507,7 +508,7 @@ results are then added using the `+` operator.
507508
Get-Process | Where-Object { ($_.ws * 2) -gt 50mb }
508509
```
509510

510-
```output
511+
```Output
511512
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
512513
------- ------ ----- ----- ----- ------ -- -----------
513514
1896 39 50968 30620 264 1,572.55 1104 explorer

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ values of a particular type, cast the variable as an array type, such as
6868
variable name with an array type enclosed in brackets. For example:
6969

7070
```powershell
71-
[int32[]]$ia = 1500, 2230, 3350, 4000
71+
[Int32[]]$ia = 1500, 2230, 3350, 4000
7272
```
7373

7474
As a result, the `$ia` array can contain only integers.
@@ -639,8 +639,8 @@ The value of `mode` must be a [WhereOperatorSelectionMode][02] enum value:
639639
- `Default` (`0`) - Return all items
640640
- `First` (`1`) - Return the first item
641641
- `Last` (`2`) - Return the last item
642-
- `SkipUntil` (`3`) - Skip items until condition is true, return all the remaining
643-
items (including the first item for which the condition is true)
642+
- `SkipUntil` (`3`) - Skip items until condition is true, return all the
643+
remaining items (including the first item for which the condition is true)
644644
- `Until` (`4`) - Return all items until condition is true
645645
- `Split` (`5`) - Return an array of two elements
646646
- The first element contains matching items

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

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ title: about_Assignment_Operators
99
# about_Assignment_Operators
1010

1111
## Short description
12+
1213
Describes how to use operators to assign values to variables.
1314

1415
## Long description
@@ -50,10 +51,10 @@ $MyShell = "PowerShell"
5051
```
5152

5253
When you assign a value to a variable in PowerShell, the variable is created if
53-
it didn't already exist. For example, the first of the following two
54-
assignment statements creates the `$a` variable and assigns a value of 6 to
55-
`$a`. The second assignment statement assigns a value of 12 to `$a`. The first
56-
statement creates a new variable. The second statement changes only its value:
54+
it didn't already exist. For example, the first of the following two assignment
55+
statements creates the `$a` variable and assigns a value of 6 to `$a`. The
56+
second assignment statement assigns a value of 12 to `$a`. The first statement
57+
creates a new variable. The second statement changes only its value:
5758

5859
```powershell
5960
$a = 6
@@ -142,20 +143,35 @@ Compound assignment operators perform numeric operations on the values before
142143
the assignment.
143144

144145
> [!IMPORTANT]
145-
> Compound assignment operators do not use dynamic scoping. The variable is
146-
> always in the current scope. In the following example, the variable `$x` is
147-
> defined in the global scope. The braces create a new scope. The variable `$x`
148-
> inside the braces is a new instance and not a reference to the global
149-
> variable.
150-
>
151-
> ```powershell
152-
> $x = 1 # Global scope
153-
> & { $x += 1; $x }
154-
> ```
155-
>
156-
> ```Output
157-
> 1
158-
> ```
146+
> Compound assignment operators don't use dynamic scoping. The variable is
147+
> always in the current scope.
148+
149+
In the following example, the variable `$x` is defined in the global scope. The
150+
braces create a new scope. The variable `$x` inside the braces is a new
151+
instance and not a copy of the global variable.
152+
153+
```powershell
154+
$x = 1 # Global scope
155+
& { $x += 1; $x }
156+
```
157+
158+
```Output
159+
1
160+
```
161+
162+
When you use the regular assignment operator, you get a copy of the variable
163+
from the parent scope. But notice that `$x` in the parent scope is not changed.
164+
165+
```powershell
166+
$x = 1 # Global scope
167+
& { $x = $x + 1; $x }
168+
"Global `$x = $x"
169+
```
170+
171+
```Output
172+
2
173+
Global $x = 1
174+
```
159175

160176
### The assignment by addition operator
161177

@@ -183,7 +199,7 @@ $a += 2
183199
$a
184200
```
185201

186-
```
202+
```Output
187203
6
188204
```
189205

@@ -240,7 +256,7 @@ assignments fail.
240256

241257
For example, the following command assigns a hash table to the `$a` variable.
242258
Then, it uses the `+=` operator to append another hash table to the existing
243-
hash table, effectively adding a new key/value pair to the existing hash table.
259+
hash table, effectively adding a new key-value pair to the existing hash table.
244260
This command succeeds, as shown in the output:
245261

246262
```powershell
@@ -279,8 +295,8 @@ At line:2 char:1
279295

280296
The assignment by subtraction operator `-=` decrements the value of a variable
281297
by the value that's specified on the right side of the operator. This operator
282-
can't be used with string variables, and it can't be used to remove an
283-
element from a collection.
298+
can't be used with string variables, and it can't be used to remove an element
299+
from a collection.
284300

285301
The `-=` operator combines two operations. First, it subtracts, and then it
286302
assigns. Therefore, the following statements are equivalent:

0 commit comments

Comments
 (0)