Return to Snippet

Revision: 30898
at August 25, 2010 02:39 by hecUngravity


Initial Code
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

Initial URL

                                

Initial Description

                                

Initial Title
list computer hosts file bindings

Initial Tags

                                

Initial Language
Visual Basic