返回函数多个返回值

一个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/

原文地址:https://www.cnblogs.com/dreamer-fish/p/3738388.html