1

我正在尝试执行下面的脚本块。这在 Win 7 上运行良好,但在 W2K3 上从未成功。作业保持在永久运行状态。知道为什么吗?

$Scriptblock = {
    Add-Content c:\temp\test.txt -Value "Starting..."
    $processes = c:\temp\test.ps1
    Add-Content c:\temp\test.txt -Value $processes
    Add-Content c:\temp\test.txt -Value "finished"
}

If (-not(Test-Path "c:\temp\test.ps1"))
{
    Add-Content c:\temp\test.ps1 -Value "get-process"
}

Start-Job -ScriptBlock $Scriptblock
4

0 回答 0