Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\WINDOWS\system32\drivers\etc\hosts",8)
objFile.WriteLine "1.1.1.1" & vbTab & "mail.126.com"
objFile.WriteLine "2.2.2.2" & vbTab & "mail.126.com"
objFile.Close
转载于:https://blog.51cto.com/terry2008/360742