【发布时间】:2018-10-26 14:58:01
【问题描述】:
我是 powershell 的新手,我正在尝试编写进度活动。
首先我创建了一个函数:
function GetPercent($current, $total) {
return ($current/$total) * 100
}
然后写
[Int32]$steps = 10
Write-Progress -Activity "Compile BLABLA project" -Status "Compiling and deploying BLABLA" -PercentComplete GetPercent(1, $steps)
我得到了错误:
写入进度:无法绑定参数“PercentComplete”。不能 将值“GetPercent”转换为类型“System.Int32”。错误:“输入 字符串格式不正确。”
我试过了
function GetPercent($current, $total) {
return ($current/$total) * 100 -as [Int32]
}
【问题讨论】:
标签: powershell