使用导出 csv 时,我的特殊字符显示为 ?是否可以批量删除特殊字符?



运行时:

$folderPath = '\dc1sharedBIHisRms'
$folderPathDest = 'C:Usersjonathon.kindredDesktopRM2'

$Columns = 'SKU', 'Landed Cost',  'Current Std Price',  'Current Sale Price',  'Free Stock',  'Markdown',  'Published Calc'

Get-ChildItem $folderPath -Name |

ForEach-Object { 

$filePath = $folderPath + $_

$filePathdest = $folderPathDest + $_

Import-Csv $filePath | Select $Columns |
Export-Csv -Path $filePathDest
}

"到岸成本"、"当前标准价格"、"当前销售价格"最终以 ?开头,例如 ?12.00。

我只想在导出过程中从这些列中删除 £ 符号,所以我只有十进制值。有谁知道我会怎么做?

您可以像这样批量删除特殊字符 £:

$csv = Import-Csv $filePath | Select $Columns
$csv | Export-csv $FilePathDesc -Encoding Unicode

特殊字符是井号,编码是 Unicode。

另外:当您在输出中看到?时,这意味着用于在终端上显示它的当前字符集无法识别它是 Unicode。 或者也许确实如此,但它没有该特定字符的代码点。

最新更新