Quick edit for your hosts file

Open notepad and paste in the code below, then save as hosts.vbs and save it inside your windows directory.

Then all you need to do is type start -> run and type “hosts.vbs” and it will fire up your windows hosts file inside notepad

Set Sh = WScript.CreateObject("WScript.Shell")
On Error Resume Next
sOStype = Sh.RegRead(_
"HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions\ProductType")
If Err.Number<>0 Then
Wscript.Echo " This doesn't appear to be an NT-like operating system;" _
& vbcrlf & "on Win9x use sysedit or msconfig."
Else
Set FSO = CreateObject("Scripting.FileSystemObject")
dirConfPath = "%SYSTEMROOT%\System32\"
On Error Resume Next
Sh.Run "Notepad " & dirConfPath & "drivers\etc\hosts"
End If

Revisions

No comments yet.

Leave a Reply