Ou use um hack rápido da VBS:
'
' Save this as "myscript.vbs" and then execute from command line like:
' cscript.exe myscript.vbs "<file to check>"
'
Option Explicit
On Error Resume Next
Err.Clear
Dim objArgs
Dim objFSO
Dim objTextFile
Dim strFileContentsIn
Dim strFileContentsOut
Dim intCharIndex
strFileContentsOut = ""
Set objArgs = WScript.Arguments
If Err.Number <> 0 Then
WScript.Echo "ERROR : Bad args."
Err.Clear
Else
Set objFSO = CreateObject( "Scripting.FileSystemObject" )
If Err.Number <> 0 Then
WScript.Echo "ERROR : Failed to create File System Object."
Err.Clear
Else
Set objTextFile = objFSO.OpenTextFile( objArgs.Item(0) )
If Err.Number <> 0 Then
WScript.Echo "ERROR : Failed to open file."
Err.Clear
Else
strFileContentsIn = objTextFile.ReadAll
If Err.Number <> 0 Then
WScript.Echo "ERROR : Failed to read file."
Err.Clear
Else
For intCharIndex = 1 To Len( strFileContentsIn )
If ( Asc(Mid( strFileContentsIn, intCharIndex, 1 )) = 10 ) Then
strFileContentsOut = strFileContentsOut & "\n" & VbCrLf
ElseIf ( Asc(Mid( strFileContentsIn, intCharIndex, 1 )) = 13 ) Then
strFileContentsOut = strFileContentsOut & "\r"
Else
strFileContentsOut = strFileContentsOut & Mid( strFileContentsIn, intCharIndex, 1 )
End If
Next
WScript.Echo strFileContentsOut
End If
objTextFile.Close
Set objTextFile = Nothing
End If
Set objFSO = Nothing
End If
End If
Versão alternativa do PowerShell mais curta. Ainda não é um comando nativo: \
(([IO.File]::ReadAllText( "<filepath>" ) -replace "'r", "\r") -replace "'n", "\n")