0
아래 코드에서 작업 출력 전에 Read-Host 라인의 출력이 표시되는 이유는 무엇입니까? 대신 당신이 $ScriptBlockForJob
의 마지막 행을 제거 할 경우 예상대로Start-Job이 예상 출력을 생성하지 않습니다.
$WorkingDirectory = Get-Location
$ScriptBlockForJob = {
Get-ChildItem $Input -Directory `
| Where-Object `
{$_.GetFiles().Count -eq 0 -and $_.GetDirectories().Count -eq 0} `
| Select-Object FullName
}
Start-Job -InputObject $WorkingDirectory -ScriptBlock $ScriptBlockForJob | Wait-Job | Receive-Job
Read-Host 'Above is a list of empty directories. Press enter to begin deleting them'
The code above yields this ouput