Advanced Windows PowerShell Scripting Video Training

Advanced Windows PowerShell Scripting Video Training
Advanced Windows PowerShell Scripting Video Training

Tuesday, December 29, 2009

Can you mark a variable as global and have it available in multiple shells.

After testing this, I am going to say no. My test was run on Windows Vista with PowerShell V2 CTP 2. I first created a global variable in one shell.

$Global:Var123 = “Hello World”

I then verified it by typing Get-Variable.

I opened a second PowerShell shell and typed $Var123....nothing. I then executed Get-Variableand confirmed that the variable was not present in the second shell.

No comments: