一个powershell函数可以有多个返回值。要接收这些返回值,只需要将返回值赋给多个变量:
function get-datetimeinfo
{
# value 1
get-date -format 'dddd'
# value 2
get-date -format 'mmmm'
# value 3
get-date -format 'hh:mm:ss'
}
$day, $month, $time = get-datetimeinfo
"today is $day, the month is $month, and it is $time"
from:http://blog.vichamp.com/powershell/tip/2013/09/09/returning-multiple-values/