Tip of the Day: Using environment variables with Windows PowerShell

Today’s Tip…

Getting environment variables in Windows has always been easy. Just bring up a CMD prompt and type ‘set’.


But what if I want to use an environment variable in Windows PowerShell? That’s easy too! Simply use ‘$env:<environment variable name>’. For example, if I wanted a variable that contains my computer name, I could use ‘$env:comptuername’ like this…


This will save me steps when scripting as I don’t have to query for my computer name and create a new variable for it. I can just use ‘$env:computername’. This works with all the environment variables.

Neat, huh?

Comments (5)

  1. David Fletcher says:

    That is neat. How do I get a list of available environment variables?

  2. nike air max says:

    michael kors bags sale, http://www.michaelkorsbags.us.org/
    michael kors, http://www.michaelkorshandbags.org.uk/
    michael kors outlet online, http://www.michael-kors-handbags.us.com/
    michael kors outlet, http://www.michaelkorsoutlet.ar.com/
    michael kors outlet, http://www.michael-kors-outlet.us.org/
    michael kors outlet online,
    michael kors outlet online sale,
    michael kors outlet store,
    michael kors uk, http://www.michaelkors-uk.org.uk/
    mont blanc pens, http://www.montblanc–pens.net/
    new balance, http://www.newbalance-outlet.org/
    nike air max, http://www.nike-air-max.us/
    nike factory, http://www.nikefactory.org/
    nike free, http://www.nikefree5.net/
    nike free run, http://www.nikefree-run.net/
    nike free, http://www.nikefree-run.org.uk/
    air jordans, http://www.nike-jordanshoes.com/
    nike mercurial, http://www.nikemercurial.net/
    nike roshe, http://www.nikerosherun.us/
    nike outlet store, http://www.nikestore.us/
    north face, http://www.northface.us.org/
    north face clearance, http://www.northfaceoutlet.com.co/
    oakley outlet, http://www.oakleyoutlet.us.org/
    oakley sunglasses, http://www.oakley-sunglasses.us.org/
    oakley sunglasses cheap, http://www.oakleysunglassescheap.in.net/
    oakley sunglasses, http://www.oakleysunglassesoutlet.com.co/
    omega watches, http://www.omegawatches.us.com/
    pandora charms, http://www.pandora-charms.org.uk/
    pandora jewelry, http://www.pandorajewelry.com.co/
    polo outlet, http://www.polo-outlets.com/
    prada outlet, http://www.pradahandbags.net.co/
    prada handbags, http://www.pradahandbags.com.co/
    prada outlet, http://www.pradashoes.com.co/
    ralph lauren uk, http://www.ralph-lauren.org.uk/
    polo ralph lauren outlet, http://www.ralphlaurenoutlet.us.com/
    ralph lauren, http://www.ralphlauren-outlet.org.uk/
    ralph lauren shirts, http://www.ralphlaurenoutletonline.com.co/
    ralph lauren outlet, http://www.ralphlaurenoutletonline.in.net/
    polo ralph lauren, http://www.ralphlaurenpolo.in.net/
    ray ban outlet, http://www.ray-ban-outlet.us.com/
    ray bans, http://www.raybans.us.org/

  3. DevilsOwn says:

    How do i get a variables content from another variable.
    Ex: $env:($env:)

  4. Qua T. says:


Skip to main content