【发布时间】:2017-08-31 00:27:16
【问题描述】:
我需要导入一个 CSV 文件,然后将完整的用户名 domain\username 替换为 username。
以下几行有效,但我只收到修改后的用户名作为输出,而不是完整文件。
您能建议吗?
$TestFile = Import-Csv .\file.csv
$NewFile = $TestFile | ForEach-Object {$_."Username" -replace 'domain\\',''}
【问题讨论】: