$BizTalkHelper = "d:\Scripts\BizTalkHelper.ps1"
.$BizTalkHelper # "dot source" the helper library.
Write-Host *** BEGIN ***
Write-Host $(Get-Date) " Desc:" {GetHostStateDesc 1 }
Write-Host $(Get-Date) " Desc:" GetHostStateDesc 2
$result = GetHostStateDesc 1
Write-Host $result
我的函数打印“你好”,此外还有一个 switch 语句将 1 转换为“已停止”、2 转换为“开始挂起”、4 转换为“正在运行”等......所以我知道在前两种情况下它没有被调用.
结果:
*** BEGIN ***
3/29/2013 11:03:34 AM Desc: GetHostStateDesc 1
3/29/2013 11:03:34 AM Desc: GetHostStateDesc 2
hello
Function GetHostStateDesc 1
Stopped