Bird
0
0

Why does PowerShell provide automatic variables like $IsWindows, $IsLinux, and $IsMacOS instead of relying on environment variables for platform detection?

hard📝 Conceptual Q10 of 15
PowerShell - Cross-Platform PowerShell
Why does PowerShell provide automatic variables like $IsWindows, $IsLinux, and $IsMacOS instead of relying on environment variables for platform detection?
ABecause automatic variables allow running commands without permissions
BBecause automatic variables are faster to access than environment variables
CBecause environment variables are only available on Windows
DBecause environment variables can be missing or inconsistent across platforms
Step-by-Step Solution
Solution:
  1. Step 1: Understand environment variable limitations

    Environment variables differ or may be missing on some platforms, making them unreliable for detection.
  2. Step 2: Understand purpose of automatic variables

    Automatic variables provide a consistent, reliable way to detect platform regardless of environment setup.
  3. Final Answer:

    Environment variables can be missing or inconsistent across platforms -> Option D
  4. Quick Check:

    Automatic variables ensure consistent platform detection [OK]
Quick Trick: Use automatic variables for reliable platform detection [OK]
Common Mistakes:
  • Thinking environment variables are always reliable
  • Believing automatic variables improve speed significantly
  • Confusing permissions with platform detection

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes