On Error Resume Next
strFileName = WScript.Arguments(0)
strReplace = WScript.Arguments(1)
If Len(Trim(strFileName)) = 0 Then
Set objFile = CreateObject("SAFRCFileDlg.FileOpen")
intRet = objFile.OpenFileOpenDlg
If intRet Then
strFileName = objFile.FileName
Set objFile = Nothing
Else
Set objFile = Nothing
WScript.Quit
End If
End If
If Len(strReplace) = 0 Then
strReplace = InputBox("输入要替换为回车的字符:")
If Len(strReplace) = 0 Then WScript.Quit
End If
Set objFile = CreateObject("Scripting.FileSystemObject")
Set f = objFile.OpenTextFile(strFileName,1)
If Err.Number <> 0 Then WScript.Echo Err.Description :WScript.Quit
strTmp = f.ReadAll
strTmp = Replace(strTmp,strReplace,Chr(13) & Chr(10))
f.Close
Set f = Nothing
Set f= objFile.OpenTextFile(strFileName & ".txt",2,True)
f.Write strTmp
f.Close
Set f = Nothing
Set objfile = Nothing
当然,如果确实想用bat解决也可以跟贴说明.