在Powershell群里?有群友问过这碧弊个问题:
$filepath = "E:\FormateFile"$DestFile = "E:\FormateFile\comb.txt"
if (Test-Path $DestFile){
Remove-Item $DestFile -Force -Confirm:$false
}
Get-ChildItem -Path $filepath -Include *.txt | ForEach-Object {
$fname = $_.Name
$content = Get-Content $fname
圆埋 for ($i = 1 $i -lt $content.Length-1 $i++) {
Add-Content -Path 橘慧蚂$DestFile -Value "$fname,$content[$i]"
}
}
$test=gc "1.txt"$test+=gc "2.txt"
$test+=gc "绝裤3.txt"和宴
$test|Export-Csv "new.csv" -notype -Encoding oem
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)