Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: [Help] need to block a website in windows 7

16 Apr 2012   #11
omn143

Win7 & Ubuntu
 
 

Quote   Quote: Originally Posted by cyclic View Post
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 System SpecsSystem Spec
.
16 Apr 2012   #12
omn143

Win7 & Ubuntu
 
 

Quote   Quote: Originally Posted by cyclic View Post
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 System SpecsSystem Spec
16 Apr 2012   #13
omn143

Win7 & Ubuntu
 
 

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 System SpecsSystem Spec
.

Reply

 [Help] need to block a website in windows 7




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Ping DG, ftp block/httpd block
Hello Guys, I find this to be quite embarrassing, having an issue like this that I can't figure out. Here's what I can't do. 1. Ping DG (Default Gateway) 2. Ping my IP (96.46.29.108) 3. Can't access my router via remote, even though its setup to allow it.
Network & Sharing
Windows firewall help allow all, block some
How does one make windows firewall allow everything to go through, but block specific exe's from having any outgoing/incoming connections?
System Security
The download button in MS Website got covered by its website!
This is what happens when I tried to download ANYTHING from Microsoft (most of them are free applications): http://img.photobucket.com/albums/v484/Shirai/microsoftwebsite_zps504d99b5.png I've tried to uninstalled silverlight and re-installed it. I've also tried with updating graphic driver,...
Browsers & Mail
Windows 7 Bad Block on Disk
Hello Guys, For the past two days now my pc has been freezing but i know much about computers but i sea that when it freeze the hard drive light turns off. So i new that no data was moving This is a pic in "Event Viewer" If you can please Help and thanks!!
Performance & Maintenance
Best way to Block a Website
Whats the best way to completely block a Website in it's entirety? More specifically, I want to completely block a PC from accessing Facebook, but only that site.
System Security
How to block a Website in Windows 7
Hi, Can you please let me know how to block a website in Windows 7. I tried this "c:\windows\system32\drivers\etc\hosts" & add the website which i want to block at the end,it is working with XP but not working with 7. Please guide me for the same. Thanks & Regards, Raghs
Browsers & Mail


Our Sites

Site Links

About Us

Find 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 21:39.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App