打印变量以控制台打印一个空值

时间:2018-09-02 16:54:13

标签: powershell

我在PowerShell中编写了以下函数,由于某种原因,当我尝试打印变量以将其屏幕打印为空时(它执行从变量开始的命令,所以我知道值已被传递)-为什么?

function Verify-Command-Dependency {
    Param($cmd, $name, $error)

    Try
    {
        $result = "$name dependency installed."
        Write-Host "$name"
        Invoke-Expression -Command "$cmd" -OutVariable out
        Write-Color -Text "[ ", "OK", " ] ", $result -Color White, Green, White, White
    }
    Catch
    {
        Write-Output $error
        Break
    }
}

0 个答案:

没有答案