By using this site, you acknowledge that you have read and understand our Cookie policy, Privacy policy and Terms .

Environment variables are commonly used in many frameworks or programs.

In PowerShell, we can use Get-ChildItem cmdlet to retrieve all the environment variables.

You can also use Get-ChildItem Env:$VariableName to retrieve the value of certain environment variable.

Code snippet

Get-ChildItem Env:
Get-ChildItem Env:PATH
info Last modified by Raymond at 11 months ago * This page is subject to Site terms.

More from Kontext

local_offer powershell

visibility 21
thumb_up 0
access_time 5 months ago

This code snippet shows how to calculate time differences.

open_in_new View open_in_new Code snippets

local_offer lite-log local_offer powershell

visibility 324
thumb_up 0
access_time 2 years ago

The following is a PowerShell code snippet to start multiple VMs through vmplayer.exe: # Navigate to the folder where vmplayer.exe file exists cd "D:\Program Files (x86)\VM Player" # Start the VMs by using vmplayer...

open_in_new View open_in_new Scripting

local_offer lite-log local_offer powershell

visibility 7755
thumb_up 1
access_time 3 years ago

PowerShell provides a number of cmdlets to retrieve current date time and to create time span object. Calculate time difference - CmdLets $current = Get-Date $end= Get-Date $diff= New-TimeSpan -Start $current -End $end Write-Output "Time difference is: $di...

open_in_new View open_in_new Scripting

info About author

Kontext dark theme mode

Dark theme mode

Dark theme mode is available on Kontext.

Learn more arrow_forward
Kontext Column

Kontext Column

Created for everyone to publish data, programming and cloud related articles. Follow three steps to create your columns.

Learn more arrow_forward
info Follow us on Twitter to get the latest article updates. Follow us