Making a variable is easy:
$var = ‘Hello’
As variables are stored in the Variable drive (a PSProvider) we can look at the drive:
cd variable:
Run a ‘dir’ to see all the contents of this drive.
We can see that we created a variable called ‘var’ and it’s contects are ‘hello’.
Next, to understand what the $ sign does I’ll do this:
New-Variable -Name $var -value ‘Goodbye’
Next, i type $hello and I get:
From this we should understand that the $ sign represents what is INSIDE the variable, not the variable name. The variables name is just ‘var’, its contents are ‘hello’, so when I created a new variable -name $var this translated into -name hello which is why a new variable called hello was created containing ‘goodbye’.