SplitFile.vbs
'/*=========================================================================
' * Intro .txt文本切割器,默認為8000個字符切為一個文件。支持拖動。
' * FileName SplitFile.vbs
' * Author yongfa365
' * Version v1.0
' * MadeTime 2008-04-24 12:58:43
' * LastModify 2008-04-24 12:58:43
' *==========================================================================*/
Set objArgs = WScript.Arguments
If objArgs.Count = 0 Then
IIIII InputBox("選擇要處理的文本文件", , "選擇要處理的文本文件")
Else
For I001 = 0 To objArgs.Count - 1
IIIII objArgs(I001)
Next
End If
Function IIIII(Path)
TempStr = ReadFromFile(Path, "gb2312")
Length = Len(TempStr)
iii = 0
For II = 0 To Length step 8000 '8000個字符切為一個文件
iii = iii + 1
WriteToFile Left(Path, Len(Path) -4) "_" Right("00" iii, 3) ".txt" , Mid(TempStr, II + 1, 8000), "gb2312"
Next
End Function
Function ReadFromFile(FileUrl, CharSet)
Dim Str
Set stm = CreateObject("Adodb.Stream")
stm.Type = 2
stm.mode = 3
stm.charset = CharSet
stm.Open
stm.loadfromfile FileUrl
Str = stm.readtext
stm.Close
Set stm = Nothing
ReadFromFile = Str
End Function
'按指定編碼存儲文件
Function WriteToFile (FileUrl, Str, CharSet)
Set stm = CreateObject("Adodb.Stream")
stm.Type = 2
stm.mode = 3
stm.charset = CharSet
stm.Open
stm.WriteText Str
stm.SaveToFile FileUrl, 2
stm.flush
stm.Close
Set stm = Nothing
End Function
您可能感興趣的文章:- VBS合并一個文件夾里的TXT的實現(xiàn)代碼
- vbs解決處理TXT文本數(shù)據(jù)相關(guān)問題實現(xiàn)代碼
- VBS實現(xiàn)將Excel表格保存為txt文本
- TXT轉(zhuǎn)HTM、HTML「TXT轉(zhuǎn)網(wǎng)頁」的vbs實現(xiàn)代碼
- 用vbs產(chǎn)生的若干個隨機數(shù)并寫入到一個.txt中的代碼
- 將HTML或txt文件轉(zhuǎn)換為ASP輸出的vbs代碼
- 用VBS將一篇txt后綴的內(nèi)容保存為html格式
- vbs操作txt文本文件常用方法與函數(shù)代碼