首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

用VBS兑现拖动文件便替换特殊字符

2012-08-15 
用VBS实现拖动文件便替换特殊字符?Set args WScript.Arguments Set fs CreateObject(Scripting.FileS

用VBS实现拖动文件便替换特殊字符

?

Set args = WScript.Arguments Set fs = CreateObject("Scripting.FileSystemObject")   If args.Count = 0 Then      MsgBox "You called this script directly, no arguments specified!" Else    For Each argument In args         filename = argument        Const ForReading = 1, ForWriting = 2, ForAppending = 8        If fs.FileExists(filename) Then               Set handle = fs.OpenTextFile(filename,ForReading,True)                Dim line              Do While handle.AtEndOfStream=False                   readStr = handle.readline                   line=line&Replace(readStr,"a","A")&vbNewLine                   'line=Replace(line,"""","'")'替换双引号为单引号                   '其它Reaplace              Loop              Set MyFile= fs.OpenTextFile(filename, ForWriting,True)              MyFile.WriteLine(line)              MyFile.Close        Else            MsgBox filename & " doesn’t exist!"        End If    Next           'MsgBox "Here’s the list of arguments:" & vbCr & listEnd If

热点排行