Powershell - Simply send objects to different variables

To support me, you can subscribe to the channel, share and like the videos, disable your ad blocker or make a donation. Thank you!

Hello,

An article to demonstrate how to simply send objects into different variables

# Define several variables, as many objects as variables
$a, $b = 1, 2
# $a will have a value of 1
# $b will have a value of 2
# Another example
$width, $height = '150*200'. Split('*')
# $width will have a value of 150
# $height will have a value of 200
# Define several variables, more objects than variables
$a, $b = 1, 2, 3
# $a will have a value of 1
# $b will have a value of 2,3
# Define several variables, fewer objects than variables
$a, $b, $c = 1, 2
# $a will have a value of 1
# $b will have a value of 2
# $c will have a value of $null

Related links