vbs変換ファイル符号化
コードを貼って記号を作って、家に帰ってからゆっくり修正します.
- '-------------------------------------------------
- ' :ReadFile
- ' : AdoDb.Stream
- '----------------------------------------------------
-
- Function ReadFile(FileUrl)
- Dim Str
- Set stm = CreateObject("Adodb.Stream")
- stm.Type = 2
- stm.mode = 3
- stm.charset = "utf-8"
- stm.Open
- stm.loadfromfile FileUrl
- Str = stm.readtext
- stm.Close
- Set stm = Nothing
- ReadFile = Str
- End Function
-
- '-------------------------------------------------
- ' :WriteToFile
- ' : AdoDb.Stream
- ' :FileUrl- ;Str- ;CharSet- (utf- 8,gb2312.....)
- '----------------------------------------------------
-
- Function WriteToFile (FileUrl, Str)
- Set stm = CreateObject("Adodb.Stream")
- stm.Type = 2
- stm.mode = 3
- stm.charset = "gb2312"
- stm.Open
- stm.WriteText Str
- stm.SaveToFile FileUrl, 2
- stm.flush
- stm.Close
- Set stm = Nothing
- End Function
-
- dim fileurl
- fileurl="C:\Documents and Settings\shaopeng_xie\ \VARIABLES.dat"
- set xmlDOC = CreateObject("MSXML2.DOMDocument")
- xmlDOC.load ("C:\Documents and Settings\shaopeng_xie\ \VARIABLES.dat")
- set oNode=xmlDOC.documentElement.SelectSingleNode("//var[@name='" & "LOGPATH" & "']")
- dim sNew
- sNew=" "
- set oCDATA=xmlDOC.createCDATASection(sNew)
- oNode.appendChild(oCDATA)
- xmlDOC.save ("C:\Documents and Settings\shaopeng_xie\ \VARIABLES.dat")
- Call writetofile(fileurl,readfile(fileurl))