相关疑难解决方法(0)

从返回的PowerShell函数将调试消息打印到控制台

有没有办法从返回值的PowerShell函数将调试消息打印到控制台?

例:

function A
{
    $output = 0

    # Start of awesome algorithm
    WriteDebug # Magic function that prints debug messages to the console
    #...
    # End of awesome algorithm

    return $output
}

# Script body
$result = A
Write-Output "Result=" $result
Run Code Online (Sandbox Code Playgroud)

是否有符合此描述的PowerShell功能?

我知道Write-Output和Write-*,但在我的所有测试中,使用上述函数中的任何函数都不会编写任何调试消息.我也知道只是在不使用返回值的情况下调用函数确实会导致函数编写调试消息.

debugging powershell function

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

debugging ×1

function ×1

powershell ×1