/ Published in: Visual Basic
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
resultPath ="c:\Scripts\Resultados\hosts.txt" set shell = WScript.CreateObject("WScript.Shell") Set objFSO = CreateObject("Scripting.FileSystemObject") Set srcFile = objFSO.OpenTextFile(shell.ExpandEnvironmentStrings("%SystemRoot%") & "\System32\drivers\etc\hosts", 1) Set objFSOW = CreateObject("Scripting.FileSystemObject") Set destFile = objFSOW.CreateTextFile(resultPath) Do Until srcFile.AtEndOfStream line = srcFile.ReadLine if Left(line,1) <> "#" AND Trim(Trim(line)) <> "" AND LEN(Replace(line,VBTab,"")) > 0 then ' Wscript.Echo line destFile.WriteLine line end if Loop srcFile.Close destFile.close shell.Run "notepad " & resultPath