How to export data to CSV in PowerShell?

后端 未结 4 1630
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-03 03:03
foreach ($computer in $computerlist) {
    if((Test-Connection -Cn $computer -BufferSize 16 -Count 1 -ea 0 -quiet))
    {
        foreach ($file in $REMOVE) {
               


        
4条回答
  •  误落风尘
    2020-12-03 03:31

    simply use the Out-File cmd but DON'T forget to give an encoding type: -Encoding UTF8

    so use it so:

    $log | Out-File -Append C:\as\whatever.csv -Encoding UTF8
    

    -Append is required if you want to write in the file more then once.

提交回复
热议问题