Recall & Review
beginner
What is an environment variable in PowerShell?
An environment variable is a named value stored by the operating system that programs can use to get information like paths or settings. In PowerShell, you can access them to customize scripts or system behavior.
Click to reveal answer
beginner
How do you list all environment variables in PowerShell?
Use the command
Get-ChildItem Env: or its alias gci Env: to see all environment variables and their values.Click to reveal answer
beginner
How can you read the value of an environment variable named 'PATH' in PowerShell?
Use
$Env:PATH to get the value of the PATH environment variable.Click to reveal answer
beginner
How do you set or change an environment variable in PowerShell for the current session?
Assign a new value like
$Env:MYVAR = 'Hello'. This change lasts only while the PowerShell window is open.Click to reveal answer
beginner
What happens if you set an environment variable in PowerShell and then close the window?
The environment variable change is lost because it was only set for the current session. To keep it permanently, you must set it in system settings or the registry.
Click to reveal answer
Which PowerShell command lists all environment variables?
✗ Incorrect
Get-ChildItem Env: lists all environment variables and their values.
How do you access the value of the environment variable 'USERNAME' in PowerShell?
✗ Incorrect
Use $Env:USERNAME to access the value of the USERNAME environment variable.
If you set $Env:MYVAR = 'Test' in PowerShell, when does this change disappear?
✗ Incorrect
Changes to environment variables in PowerShell last only for the current session and disappear when the window closes.
Which prefix is used to access environment variables in PowerShell?
✗ Incorrect
Environment variables are accessed with the $Env: prefix in PowerShell.
To permanently set an environment variable in Windows, you should:
✗ Incorrect
Permanent environment variables must be set in system settings or the Windows registry, not just in PowerShell.
Explain how to view, read, and set environment variables in PowerShell.
Think about commands to list, read, and assign environment variables.
You got /4 concepts.
Describe the difference between temporary and permanent environment variables in Windows and PowerShell.
Consider where variables are stored and how long they last.
You got /4 concepts.