Sending Variables through Environment Variables

by Mar 19, 2012

Let's assume you want to launch a new PowerShell session from an existing one. To carry over information from the initial session, you can use environment variables:

$env:payload = 'Some Information'
Start-Process powershell -ArgumentList '-noexit -command Write-Host "I 
received: $env:payload"'

Twitter This Tip! ReTweet this Tip!