Tuesday, 14 August 2012

Expanding Strings And Environment Variables in PowerShell

I hadn't realised this was possible, but you can use environment variables in Powershell. I don't mean by doing something like this

$tempvar = $env:temp

Instead if you have a string which contains environment variables in the form of %temp% for example.

Read the this blog post to get the full lowdown.
http://blogs.microsoft.co.il/blogs/scriptfanatic/archive/2011/01/02/how-to-expand-strings-and-environment-variables-in-powershell.aspx

No comments: