在有些机器上start-transcript 不会记录
write-host的输出信息
$logdate = get-date
$logfilepath = $env:userprofile +”\desktop\s3s4device\s3s4device_” + $logdate.year +$logdate.month + $logdate.day + $logdate.hour + $logdate.minute + $logdate.second + “.log”
start-transcript -Path $logfilepath
for($i =0; $i -le 10; $i++)
{
start-sleep -s 5
Write-Host “count:” $i “`r`n” -NoNewline
}
Stop-Transcript
你是什么机器呢?
intel braswell的新平台,我已经明白了,这个是powershell的 bug https://social.technet.microsoft.com/Forums/windowsserver/en-US/cecc4f32-28c8-4bdc-be63-49ce3d396625/powershell-4-starttranscript-does-not-log-writehost