How to kill a certain website with batch files

1

How could I make my webbrowser (chrome.exe) to shut down whenever I visited Facebook.com? Is this possible? I'm not too good with batches but I try my best ;)

edit: I may need to clairify, I cant do it with host files because they're blocked in my school ;) I have tried... I could If I would replase system 32 and it doesnt seem like a good Idea XD so well I dont actually need a batch file just anytime of file, a vbs would also do.

also content blockers are blocked...

edit 2 (not some invisibility cloaks eather cause cant use these eather, and I want another way around it)

Daniel

Posted 2011-10-04T16:48:12.123

Reputation: 11

1With a batch file? Do you want it automatic or manually initiated? A batch file can't just run on its own, you'd need some way of launching it. – Shinrai – 2011-10-04T16:51:17.723

You could write some sort of script that watches the title of the chrome.exe window and kills the process when 'Facebook' appears. I just don't know if it is possible with .bat files. – Duijf – 2011-10-04T16:51:48.420

Does it have to be a batch script? You could just block facebook.com in your hosts file. – Jin – 2011-10-04T16:54:25.150

2I should clarify what I meant by my comment, since none of the other comments have hit the same point - what's the GOAL you're trying to accomplish here? You're not making it very clear and the answer may vary by a lot. – Shinrai – 2011-10-04T17:02:47.250

Your edit doesn't help very much. What's the goal here? You don't want to be able to browse to Facebook? In that case the best solution is just don't browse to Facebook. – Shinrai – 2011-10-04T17:54:54.007

Answers

2

This doesn't involve batch files per se, but you can use the Invisibility Cloak user script to block views of Facebook or other sites during certain hours.

Michael Hoffman

Posted 2011-10-04T16:48:12.123

Reputation: 387

1

In Windows 7 (and any version of Windows) you can edit your HOSTS file located under

c:\windows\system32\drivers\etc

In there you can add

127.0.0.1    www.facebook.com

This will loop back to your computer whenever you try to go to www.facebook.com. If there is specific parts of facebook that you wish to avoid like ads then you can add another like. For example, if facebook's has ads that are located at ads.facebook.com then you would have your HOSTS file to look like

127.0.0.1    www.facebook.com
127.0.0.1    ads.facebook.com

I know that this is not exactly what you're looking for, but could be a different solution to what you may be trying to accomplish.

kobaltz

Posted 2011-10-04T16:48:12.123

Reputation: 14 361