我有我的Windows服务器的一些问题,我需要添加 – 服务器傀儡运行或它将无法正常工作,尽pipe在configuration文件中设置了正确的服务器。 我想知道是否有一个Linux行结束,而不是一个Windows crlf。 什么是一个简单的方法来检查这个从Windows窗口?
或者使用一个快速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
可选的,更短的PowerShell版本。 仍然不是一个本地命令:\
(([IO.File]::ReadAllText( "<filepath>" ) -replace "`r", "\r") -replace "`n", "\n")