[Help] need to block a website in windows 7

Page 2 of 2 FirstFirst 12

  1. Posts : 7
    Win7 & Ubuntu
    Thread Starter
       #11

    cyclic said:
    Why cant you edit the Hosts file, it's direct and cant be got around. Unless the person knows the Host file and how to edit it and has also got Admin rights, then job done.
    The problem he is far away from me , so i cant just go and do this for him, otherwise I will make sure he will forget the website at all .lol

    That's way am looking for undirected way to do this, so the whole thing will stay not known for him
      My Computer


  2. Posts : 7
    Win7 & Ubuntu
    Thread Starter
       #12

    cyclic said:
    OK I give in here is one with examples.

    code :
    @echo off
    set hostspath=%windir%\System32\drivers\etc\hosts
    echo 62.116.159.4 ns1.intranet.de >> %hostspath%
    echo 217.160.113.37 ns2.intranet.de >> %hostpath%
    echo 89.146.248.4 ns3.intranet.de >> %hostpath%
    echo 74.208.254.4 ns4.intranet.de >> %hostpath%
    exit
    code:
    gr8, I'll try this
      My Computer


  3. Posts : 7
    Win7 & Ubuntu
    Thread Starter
       #13

    I found this

    Code:
    @echo off
    TITLE Modifying your HOSTS file
    COLOR 85
    ECHO.
    
    
    :LOOP
    SET Choice=
    SET /P Choice="Do you want to modify HOSTS file ? (Y/N)"
    
    IF NOT '%Choice%'=='' SET Choice=%Choice:~0,1%
    
    ECHO.
    IF /I '%Choice%'=='Y' GOTO ACCEPTED
    IF /I '%Choice%'=='N' GOTO REJECTED
    ECHO Please type Y (for Yes) or N (for No) to proceed!
    ECHO.
    GOTO Loop
    
    
    :REJECTED
    ECHO Your HOSTS file was left unchanged >> %systemroot%\Temp\yourinstall.log
    ECHO Finished.
    GOTO END
    
    :ACCEPTED
    ECHO Carrying out requested modifications to your HOSTS file
    echo 127.0.0.1   local host >> %WinDir%\system32\drivers\etc\hosts
    ECHO Finished.
    
    GOTO END
    
    :END
    ECHO.
    EXIT
    from here
    and this:

    Code:
    Const ForReading = 1, ForWriting = 2, ForAppending = 8, ReadOnly = 1
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set WshShell=CreateObject("WScript.Shell")
    WinDir =WshShell.ExpandEnvironmentStrings("%WinDir%")
    
    HostsFile = WinDir & "\System32\Drivers\etc\Hosts"
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile(HostsFile, ForReading)
    
    Do Until objFile.AtEndOfStream
     If InStr (objFile.ReadLine, "10.10.10.105") <> 0 Then
     WScript.Quit
     End If
     i = i + 1
    Loop
    objFile.Close
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.GetFile(HostsFile)
    If objFile.Attributes AND ReadOnly Then
     objFile.Attributes = objFile.Attributes XOR ReadOnly
    End If
    
    Set filetxt = fso.OpenTextFile(HostsFile, ForAppending, True)
    filetxt.WriteLine(vbNewLine & "10.10.10.105 intranet.corp www.intranet.corp intranet www.intranet")
    filetxt.Close
    WScript.quit
    from here

    I will tray them all an see if they did what i want>>
      My Computer


 
Page 2 of 2 FirstFirst 12

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 18:29.
Find Us