Skip to content

Commit 65898ba

Browse files
authored
Fixes #10279 - Add lists of variables to the top of the articles (#10282)
* Add lists of variables to the top of the articles * fix typo
1 parent e053a55 commit 65898ba

File tree

8 files changed

+356
-132
lines changed

8 files changed

+356
-132
lines changed

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

Lines changed: 47 additions & 4 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: 05/08/2023
4+
ms.date: 07/17/2023
55
no-loc: [Reset, Current, Background, Blink, Bold, Foreground, Formatting, Hidden, Italic, Reset, Reverse, Underline]
66
online version: https://learn.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
@@ -15,14 +15,57 @@ title: about Automatic Variables
1515
Describes variables that store state information for and are created and
1616
maintained by PowerShell.
1717

18-
## Long description
19-
2018
Conceptually, most of these variables are considered to be read-only. Even
2119
though they _can_ be written to, for backward compatibility they _should not_
2220
be written to.
2321

2422
Here is a list of the automatic variables in PowerShell:
2523

24+
- [$$](#section)
25+
- [$?](#section-1)
26+
- [$^](#section-2)
27+
- [$_](#_)
28+
- [$args](#args)
29+
- [$ConsoleFileName](#consolefilename)
30+
- [$Error](#error)
31+
- [$Event](#event)
32+
- [$EventArgs](#eventargs)
33+
- [$EventSubscriber](#eventsubscriber)
34+
- [$ExecutionContext](#executioncontext)
35+
- [$false](#false)
36+
- [$foreach](#foreach)
37+
- [$HOME](#home)
38+
- [$Host](#host)
39+
- [$input](#input)
40+
- [$LASTEXITCODE](#lastexitcode)
41+
- [$Matches](#matches)
42+
- [$MyInvocation](#myinvocation)
43+
- [$NestedPromptLevel](#nestedpromptlevel)
44+
- [$null](#null)
45+
- [$PID](#pid)
46+
- [$PROFILE](#profile)
47+
- [$PSBoundParameters](#psboundparameters)
48+
- [$PSCmdlet](#pscmdlet)
49+
- [$PSCommandPath](#pscommandpath)
50+
- [$PSCulture](#psculture)
51+
- [$PSDebugContext](#psdebugcontext)
52+
- [$PSEdition](#psedition)
53+
- [$PSHOME](#pshome)
54+
- [$PSItem](#psitem)
55+
- [$PSScriptRoot](#psscriptroot)
56+
- [$PSSenderInfo](#pssenderinfo)
57+
- [$PSUICulture](#psuiculture)
58+
- [$PSVersionTable](#psversiontable)
59+
- [$PWD](#pwd)
60+
- [$Sender](#sender)
61+
- [$ShellId](#shellid)
62+
- [$StackTrace](#stacktrace)
63+
- [$switch](#switch)
64+
- [$this](#this)
65+
- [$true](#true)
66+
67+
## Long description
68+
2669
### $$
2770

2871
Contains the last token in the last line received by the session.
@@ -176,7 +219,7 @@ value of the `"$env:USERPROFILE"` Windows environment variable, typically
176219

177220
> [!IMPORTANT]
178221
> Windows can redirect the location of the user's profile. This means that
179-
> `$HOME` may not have the same value as `$env:HOMEDRIVE$env:HOMEPATH`.
222+
> `$HOME` may not have the same value as `"$env:HOMEDRIVE$env:HOMEPATH"`.
180223
181224
### $Host
182225

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

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Describes how to access and manage environment variables in PowerShell.
33
Locale: en-US
4-
ms.date: 11/30/2022
4+
ms.date: 07/17/2023
55
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-5.1&WT.mc_id=ps-gethelp
66
schema: 2.0.0
77
title: about Environment Variables
@@ -11,12 +11,18 @@ title: about Environment Variables
1111
## Short description
1212
Describes how to access and manage environment variables in PowerShell.
1313

14-
## Long description
15-
1614
Environment variables store data that's used by the operating system and other
17-
programs. For example, the `WINDIR` environment variable contains the location
18-
of the Windows installation directory. Programs can query the value of this
19-
variable to determine where Windows operating system files are located.
15+
programs. PowerShell creates the following environment variables:
16+
17+
- **PSExecutionPolicyPreference**
18+
- **PSModulePath**
19+
- **PSModuleAnalysisCachePath**
20+
- **PSDisableModuleAnalysisCacheCleanup**
21+
22+
For full descriptions of these variables, see the
23+
[PowerShell environment variables][03] of this article.
24+
25+
## Long description
2026

2127
PowerShell can access and manage environment variables in any of the supported
2228
operating system platforms. The PowerShell environment provider lets you get,
@@ -140,7 +146,7 @@ Name MemberType Definition
140146
Length Property int Length {get;}
141147
```
142148

143-
For more information about variables in PowerShell, see [about_Variables][10].
149+
For more information about variables in PowerShell, see [about_Variables][11].
144150

145151
## Using the Environment provider and Item cmdlets
146152

@@ -187,7 +193,7 @@ VERBOSE: Performing the operation "Remove Item" on target "Item: Foo".
187193
```
188194

189195
For more information on using the **Environment** provider to manage
190-
environment variables, see [about_Environment_Provider][03].
196+
environment variables, see [about_Environment_Provider][04].
191197

192198
## Using the System.Environment methods
193199

@@ -244,7 +250,7 @@ $Env:Path += ';C:\Tools'
244250
```
245251

246252
You can get the path to your PowerShell profile with the `$PROFILE` automatic
247-
variable. For more information on profiles, see [about_Profiles][06].
253+
variable. For more information on profiles, see [about_Profiles][07].
248254

249255
### Saving environment variables with SetEnvironmentVariable
250256

@@ -288,7 +294,7 @@ System Control Panel:
288294
PowerShell features can use environment variables to store user preferences.
289295
These variables work like preference variables, but they're inherited by child
290296
sessions of the sessions in which they're created. For more information about
291-
preference variables, see [about_Preference_Variables][05].
297+
preference variables, see [about_Preference_Variables][06].
292298

293299
The environment variables that store preferences include:
294300

@@ -304,7 +310,7 @@ The environment variables that store preferences include:
304310
- Use the `Set-ExecutionPolicy` cmdlet. Use the **Scope** parameter with
305311
a value of `Process`.
306312

307-
For more information, see [about_Execution_Policies][04].
313+
For more information, see [about_Execution_Policies][05].
308314

309315
- **PSModulePath**
310316

@@ -320,7 +326,7 @@ The environment variables that store preferences include:
320326
- User-installed modules: These are modules installed by the user.
321327
`Install-Module` has a **Scope** parameter that allows you to specify
322328
whether the module is installed for the current user or for all users. For
323-
more information, see [Install-Module][13].
329+
more information, see [Install-Module][14].
324330

325331
- On Windows, the location of the user-specific **CurrentUser** scope is
326332
the `$HOME\Documents\PowerShell\Modules` folder. The location of the
@@ -330,7 +336,7 @@ The environment variables that store preferences include:
330336
as the Program Files directory, can append their locations to the value of
331337
`$env:PSModulePath`.
332338

333-
For more information, see [about_PSModulePath][07].
339+
For more information, see [about_PSModulePath][08].
334340

335341
- **PSModuleAnalysisCachePath**
336342

@@ -415,18 +421,19 @@ The environment variables that store preferences include:
415421

416422
## See also
417423

418-
- [about_Environment_Provider][03]
419-
- [about_Profiles][06]
420-
- [about_Variables][10]
424+
- [about_Environment_Provider][04]
425+
- [about_Profiles][07]
426+
- [about_Variables][11]
421427
- [Environment Methods][01]
422428

423429
<!-- link references -->
424430
[01]: /dotnet/api/system.environment
425431
[02]: /windows-server/administration/windows-commands/ftype
426-
[03]: about_Environment_Provider.md
427-
[04]: about_Execution_Policies.md
428-
[05]: about_preference_variables.md
429-
[06]: about_profiles.md
430-
[07]: about_PSModulePath.md
431-
[10]: about_variables.md
432-
[13]: xref:PowerShellGet.Install-Module
432+
[03]: #powershell-environment-variables
433+
[04]: about_Environment_Provider.md
434+
[05]: about_Execution_Policies.md
435+
[06]: about_preference_variables.md
436+
[07]: about_profiles.md
437+
[08]: about_PSModulePath.md
438+
[11]: about_variables.md
439+
[14]: xref:PowerShellGet.Install-Module

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

Lines changed: 52 additions & 4 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: 05/08/2023
4+
ms.date: 07/17/2023
55
no-loc: [Reset, Current, Background, Blink, Bold, Foreground, Formatting, Hidden, Italic, Reset, Reverse, Underline]
66
online version: https://learn.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
@@ -15,14 +15,62 @@ title: about Automatic Variables
1515
Describes variables that store state information for and are created and
1616
maintained by PowerShell.
1717

18-
## Long description
19-
2018
Conceptually, most of these variables are considered to be read-only. Even
2119
though they _can_ be written to, for backward compatibility they _should not_
2220
be written to.
2321

2422
Here is a list of the automatic variables in PowerShell:
2523

24+
- [$$](#section)
25+
- [$?](#section-1)
26+
- [$^](#section-2)
27+
- [$_](#_)
28+
- [$args](#args)
29+
- [$ConsoleFileName](#consolefilename)
30+
- [$EnabledExperimentalFeatures](#enabledexperimentalfeatures)
31+
- [$Error](#error)
32+
- [$Event](#event)
33+
- [$EventArgs](#eventargs)
34+
- [$EventSubscriber](#eventsubscriber)
35+
- [$ExecutionContext](#executioncontext)
36+
- [$false](#false)
37+
- [$foreach](#foreach)
38+
- [$HOME](#home)
39+
- [$Host](#host)
40+
- [$input](#input)
41+
- [$IsCoreCLR](#iscoreclr)
42+
- [$IsLinux](#islinux)
43+
- [$IsMacOS](#ismacos)
44+
- [$IsWindows](#iswindows)
45+
- [$LASTEXITCODE](#lastexitcode)
46+
- [$Matches](#matches)
47+
- [$MyInvocation](#myinvocation)
48+
- [$NestedPromptLevel](#nestedpromptlevel)
49+
- [$null](#null)
50+
- [$PID](#pid)
51+
- [$PROFILE](#profile)
52+
- [$PSBoundParameters](#psboundparameters)
53+
- [$PSCmdlet](#pscmdlet)
54+
- [$PSCommandPath](#pscommandpath)
55+
- [$PSCulture](#psculture)
56+
- [$PSDebugContext](#psdebugcontext)
57+
- [$PSEdition](#psedition)
58+
- [$PSHOME](#pshome)
59+
- [$PSItem](#psitem)
60+
- [$PSScriptRoot](#psscriptroot)
61+
- [$PSSenderInfo](#pssenderinfo)
62+
- [$PSUICulture](#psuiculture)
63+
- [$PSVersionTable](#psversiontable)
64+
- [$PWD](#pwd)
65+
- [$Sender](#sender)
66+
- [$ShellId](#shellid)
67+
- [$StackTrace](#stacktrace)
68+
- [$switch](#switch)
69+
- [$this](#this)
70+
- [$true](#true)
71+
72+
## Long description
73+
2674
### $$
2775

2876
Contains the last token in the last line received by the session.
@@ -179,7 +227,7 @@ typically `C:\Users\<UserName>`. On Unix, this variable uses the value of the
179227

180228
> [!IMPORTANT]
181229
> Windows can redirect the location of the user's profile. This means that
182-
> `$HOME` may not have the same value as `$env:HOMEDRIVE$env:HOMEPATH`.
230+
> `$HOME` may not have the same value as `"$env:HOMEDRIVE$env:HOMEPATH"`.
183231
184232
### $Host
185233

0 commit comments

Comments
 (0)