PowerTip: Accessing System Values

PowerTip: Accessing System Values

  • Comments 2
  • Likes

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

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • 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.