PowerTip: Accessing System Values

PowerTip: Accessing System Values

Rate This
  • Comments 2

Summary: Use Windows PowerShell to ease access to system values.

Hey, Scripting Guy! Question How can l print out the value of %systemroot%?

Hey, Scripting Guy! Answer 

a. (get-item Env:\systemroot).value

b. $env:systemroot

Leave a Comment
  • Please add 3 and 8 and type the answer here:
  • Post
  • hi Ed,

    thank's for sharing, here some variant:

    PS II> split-path ([Environment]::SystemDirectory)

    PS II> gc env:\windir

    PS II> [ENVIRONMENT]::ExpandEnvironmentVariables('%WINDIR%')

  • @Walid Toumi woohoo!!! I love it. The cool thing about PowerShell is there are so many ways to do exactly the same things! Thanks for sharing.

Page 1 of 1 (2 items)