Created
March 10, 2025 12:31
-
-
Save anzz1/cd48ac3b995252c56b216829be585131 to your computer and use it in GitHub Desktop.
unixlf.cmd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# : | |
@setlocal disabledelayedexpansion enableextensions | |
@echo off | |
powershell -nol -noni -nop -ex bypass -c "&{[ScriptBlock]::Create((cat '%~f0') -join [Char[]]10).Invoke(@(&{$args}%*))}" | |
exit /b | |
#> | |
Write-Host === CRLF -> LF ===`n | |
$items = dir .\ -recurse | where {$_.extension -in ".sln",".vcproj",".vcxproj",".vcxproj.filters",".md",".cs",".c",".h",".cpp",".inc",".hpp",".txt",".cc",".log",".def",".asm",".mk",".s",".json",".lua",".xml",".ini",".sql",".cfg",".nsh",".nsi",".sma",".php",".sh",".res",".bat",".conf",".js"} | |
if ($args[0] -ceq 'y') { | |
foreach($file in $items) | |
{ | |
Write-Host Processed: $file.Name | |
$text = [IO.File]::ReadAllText($file.FullName) -replace "`r`n", "`n" | |
[IO.File]::WriteAllText($file.FullName, $text) | |
} | |
Write-Host `nDone. | |
} | |
else { | |
foreach($file in $items) | |
{ | |
Write-Host File: $file.Name | |
} | |
Write-Host `nTo confirm and process these files enter `'unixlf y`' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment