22 lines
795 B
PowerShell
22 lines
795 B
PowerShell
# 简化的换行符转换脚本
|
|
Write-Host "开始转换.uvue文件换行符..." -ForegroundColor Green
|
|
|
|
$files = Get-ChildItem -Path "." -Filter "*.uvue" -Recurse
|
|
Write-Host "找到 $($files.Count) 个.uvue文件"
|
|
|
|
$converted = 0
|
|
foreach ($file in $files) {
|
|
try {
|
|
$content = [System.IO.File]::ReadAllText($file.FullName)
|
|
$newContent = $content -replace "`r`n", "`n" -replace "`r", "`n"
|
|
[System.IO.File]::WriteAllText($file.FullName, $newContent, [System.Text.UTF8Encoding]::new($false))
|
|
$converted++
|
|
Write-Host "转换: $($file.Name)" -ForegroundColor Cyan
|
|
}
|
|
catch {
|
|
Write-Host "错误: $($file.Name) - $($_.Exception.Message)" -ForegroundColor Red
|
|
}
|
|
}
|
|
|
|
Write-Host "完成! 转换了 $converted 个文件" -ForegroundColor Green
|