Tied Variables in PowerShell

Tuesday, April 12, 2011

When PowerShell starts it creates a bunch of Automatic Variables. One of them is $PWD. $PWD contains a path object that represents the full path of the current directory (provider sensitive). Typically, when you assign a value to a variable, the value is evaluated once and from then on it's "static", each time you call the variable the returned value is always the same. The beauty of $PWD is that its value is calculated each time you call it. PS> $PWD Path ---- D:\scripts PS >...