Assigning Variables

With PowerShell, you can assign values to multiple variables. For example, to initialize three variables to the same default value, use this:

$a = $b = $c = 0

To assign different values to a number of variables, use the comma separator.

$a, $b, $c = 1,2,3

To switch variable content, try this:

$a, $b = $b, $a

Posted Nov 02 2008, 08:00 AM by ps1
Copyright 2012 PowerShell.com. All rights reserved.