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 & list End If
用VBS实现拖动文件便替换特殊字符
猜你喜欢
转载自soft-development.iteye.com/blog/1400221
今日推荐
周排行