Bird
0
0

Why might changes made to environment variables using $env:VAR = 'value' not persist after closing PowerShell?

hard📝 Conceptual Q10 of 15
PowerShell - System Administration
Why might changes made to environment variables using $env:VAR = 'value' not persist after closing PowerShell?
ABecause PowerShell requires administrator rights to change env vars
BBecause environment variables are read-only
CBecause the syntax is incorrect
DBecause $env: changes only affect the current session
Step-by-Step Solution
Solution:
  1. Step 1: Understand scope of $env: variable changes

    Changes to $env:VAR affect only the current PowerShell session.
  2. Step 2: Evaluate other options

    Environment variables are writable, admin rights are not always required, and syntax is correct.
  3. Final Answer:

    Because $env: changes only affect the current session -> Option D
  4. Quick Check:

    Session-only env var changes = C [OK]
Quick Trick: Session env var changes vanish after closing shell [OK]
Common Mistakes:
  • Thinking $env: changes are permanent
  • Assuming admin needed always
  • Blaming syntax errors incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes