#powershell
$path = "C:\tmp\112.csv"
$data = Import-Csv -Path $Path
$ColNames = ($data[0].psobject.Properties).name
$header = ""
foreach($column in $ColNames)
{
if(![string]::IsNullOrEmpty($header)){
$header = $header + ","
$header = $header + $column
}
else{
$header = $header + $column
}
}
add-content -path $path -value $header
foreach($line in $data)
{
Export-CSV -path $path -InputObject $line -Append -NoTypeInformation
}
# Export-CSV can add quotation by default.
CSV file转成各个字段都加双引号
最新推荐文章于 2024-10-22 12:48:54 发布
556

被折叠的 条评论
为什么被折叠?



