1
1
---
2
2
description : Describes how to access and manage environment variables in PowerShell.
3
3
Locale : en-US
4
- ms.date : 11/30/2022
4
+ ms.date : 07/17/2023
5
5
online version : https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-5.1&WT.mc_id=ps-gethelp
6
6
schema : 2.0.0
7
7
title : about Environment Variables
@@ -11,12 +11,18 @@ title: about Environment Variables
11
11
## Short description
12
12
Describes how to access and manage environment variables in PowerShell.
13
13
14
- ## Long description
15
-
16
14
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
20
26
21
27
PowerShell can access and manage environment variables in any of the supported
22
28
operating system platforms. The PowerShell environment provider lets you get,
@@ -140,7 +146,7 @@ Name MemberType Definition
140
146
Length Property int Length {get;}
141
147
```
142
148
143
- For more information about variables in PowerShell, see [ about_Variables] [ 10 ] .
149
+ For more information about variables in PowerShell, see [ about_Variables] [ 11 ] .
144
150
145
151
## Using the Environment provider and Item cmdlets
146
152
@@ -187,7 +193,7 @@ VERBOSE: Performing the operation "Remove Item" on target "Item: Foo".
187
193
```
188
194
189
195
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 ] .
191
197
192
198
## Using the System.Environment methods
193
199
@@ -244,7 +250,7 @@ $Env:Path += ';C:\Tools'
244
250
```
245
251
246
252
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 ] .
248
254
249
255
### Saving environment variables with SetEnvironmentVariable
250
256
@@ -288,7 +294,7 @@ System Control Panel:
288
294
PowerShell features can use environment variables to store user preferences.
289
295
These variables work like preference variables, but they're inherited by child
290
296
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 ] .
292
298
293
299
The environment variables that store preferences include:
294
300
@@ -304,7 +310,7 @@ The environment variables that store preferences include:
304
310
- Use the ` Set-ExecutionPolicy ` cmdlet. Use the ** Scope** parameter with
305
311
a value of ` Process ` .
306
312
307
- For more information, see [ about_Execution_Policies] [ 04 ] .
313
+ For more information, see [ about_Execution_Policies] [ 05 ] .
308
314
309
315
- ** PSModulePath**
310
316
@@ -320,7 +326,7 @@ The environment variables that store preferences include:
320
326
- User-installed modules: These are modules installed by the user.
321
327
` Install-Module ` has a ** Scope** parameter that allows you to specify
322
328
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 ] .
324
330
325
331
- On Windows, the location of the user-specific ** CurrentUser** scope is
326
332
the ` $HOME\Documents\PowerShell\Modules ` folder. The location of the
@@ -330,7 +336,7 @@ The environment variables that store preferences include:
330
336
as the Program Files directory, can append their locations to the value of
331
337
` $env:PSModulePath ` .
332
338
333
- For more information, see [ about_PSModulePath] [ 07 ] .
339
+ For more information, see [ about_PSModulePath] [ 08 ] .
334
340
335
341
- ** PSModuleAnalysisCachePath**
336
342
@@ -415,18 +421,19 @@ The environment variables that store preferences include:
415
421
416
422
## See also
417
423
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 ]
421
427
- [ Environment Methods] [ 01 ]
422
428
423
429
<!-- link references -->
424
430
[ 01 ] : /dotnet/api/system.environment
425
431
[ 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
0 commit comments