Bird
0
0

How do you assign the value 456 to an environment variable named CONFIG_ID in PowerShell?

easy📝 Syntax Q3 of 15
PowerShell - System Administration
How do you assign the value 456 to an environment variable named CONFIG_ID in PowerShell?
Aenv CONFIG_ID=456
BSet-Variable -Name CONFIG_ID -Value 456
C$env:CONFIG_ID = '456'
DSet-Env CONFIG_ID 456
Step-by-Step Solution
Solution:
  1. Step 1: Use the $env: prefix

    In PowerShell, environment variables are accessed and set using the $env: prefix.
  2. Step 2: Assign the value as a string

    Assign the value '456' as a string to the variable CONFIG_ID using the syntax $env:CONFIG_ID = '456'.
  3. Final Answer:

    $env:CONFIG_ID = '456' -> Option C
  4. Quick Check:

    Check that the variable is set by running Write-Output $env:CONFIG_ID [OK]
Quick Trick: Use $env:VariableName = 'Value' to set environment variables [OK]
Common Mistakes:
  • Using Set-Variable instead of $env:
  • Trying to set environment variables like shell variables
  • Using incorrect commands like env or Set-Env

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes