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