本帖最后由 czjt1234 于 2022-12-15 07:52 编辑
- Dim oStream, file1, file2, s
-
- file1 = "1.txt" '源文件
- file2 = "2.txt" '目标文件
-
- Set oStream = CreateObject("ADODB.Stream")
- oStream.Type = 2 'adTypeText
- oStream.Mode = 3 'adModeReadWrite
- oStream.Charset = "gb2312" '原编码
- oStream.Open()
- oStream.LoadFromFile file1
- s = oStream.ReadText()
- oStream.Close()
- oStream.Charset = "utf-8" '目标编码
- oStream.Open()
- oStream.WriteText s
- oStream.SaveToFile file2, 2 'adSaveCreateOverWrite
- oStream.Close()
-
- MsgBox "ok"
复制代码
可能你还需要一个转换编码的vbs |