- rem 另存为 ANSI 编码
- ' & cls & cscript.exe /nologo /e:vbscript "%~f0" %* & pause & exit
-
- Dim oWshShell, oFSO, oStream, s
-
- Const file = "test.txt" '原文件。支持文件拖放,支持文件名作为命令行参数
- Const charset = "GBK" '文件编码。支持Unicode和UTF-8
-
- Set oWshShell = CreateObject("WScript.Shell")
- Set oFSO = CreateObject("Scripting.FileSystemObject")
- s = oFSO.GetParentFolderName(WScript.ScriptFullname)
- oWshShell.CurrentDirectory = s
-
- Set oStream = CreateObject("ADODB.Stream")
- oStream.Type = 2 'adTypeText
- oStream.Mode = 3 'adModeReadWrite
- oStream.Charset = charset
-
- If WScript.Arguments.Count > 0 Then
- For Each s In WScript.Arguments
- Call run(s)
- Next
- Else
- Call run(file)
- End If
-
- Sub run(ByVal file)
- Dim s
- oStream.Open()
- oStream.LoadFromFile file
- s = oStream.ReadText()
- oStream.Close()
- s = RePlace(s, "&x-amz-limitrate=50", "")
- WScript.Echo s
- End Sub
复制代码
|