# Script to convert line endings from Unix (LF) to Windows (CRLF) format param( [Parameter(Mandatory=$true)] [string]$FolderPath, [Parameter(Mandatory=$false)] [string[]]$FileExtensions = @("*.txt", "*.cs", "*.json", "*.xml", "*.config", "*.ps1") ) # Verify the folder exists if (-not (Test-Path -Path $FolderPath -PathType Container)) { Write-Error "The specified folder does not exist: $FolderPath" exit 1 } Write-Host "Converting line endings in folder: $FolderPath" foreach ($extension in $FileExtensions) { $files = Get-ChildItem -Path $FolderPath -Filter $extension -Recurse -File foreach ($file in $files) { try { Write-Host "Processing: $($file.FullName)" # Read file as bytes to properly handle line endings $bytes = [System.IO.File]::ReadAllBytes($file.FullName) $content = [System.Text.Encoding]::UTF8.GetString($bytes) # Replace only LF (not preceded by CR) with CRLF $newContent = $content -replace "(?