A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Windows 10 » Windows 10 Help Forum
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

What is the easiest way to edit the hosts file on Windows as admin?



 
 
Thread Tools Rate Thread Display Modes
  #46  
Old July 12th 17, 12:49 PM posted to alt.comp.os.windows-10
Lionel Muller
external usenet poster
 
Posts: 119
Default What is the easiest way to edit the hosts file on Windows as admin?

For alt.comp.os.windows-10 wrote:


I use a small BAT file that a) changes the rights from restricted to
not b) asks NOTEPAD to open HOSTS then c) upon closing of NOTEPAD,
puts the restrictions back on

Attrib -r C:\Windows\System32\drivers\etc\Hosts

"D:\Program Files\Notepad++\notepad++.exe"
C:\Windows\System32\drivers\etc\Hosts

Attrib +r C:\Windows\System32\drivers\etc\Hosts

I run it buy right clicking on the Bat on the desk top and clicking on
Run as Administrator.

Been doing this since there was a HOSTS file.


Thanks for writing this up where you remove restrictions and then edit the
file as the user and then add back the restrictions, which gets you around
the administrator problem.

You use a batch file which gets you around the path problem to the hosts
file (which admittedly, is in a lousy location).

I especially appreciate that you were one of the few who actually
understood the question enough to propose a viable solution.

I think I'll stick with the solution I came up with, which doesn't require
changing the file permissions and which works either from a shortcut or a
menu:
Start Programs hosts
or
Start Run hosts

See the details in the tutorial I wrote up.

Thanks for helping out!
Ads
  #47  
Old July 12th 17, 12:49 PM posted to alt.comp.os.windows-10
Lionel Muller
external usenet poster
 
Posts: 119
Default What is the easiest way to edit the hosts file on Windows as admin?

For alt.comp.os.windows-10 Char Jackson wrote:

Thanks. I use the thing which you laugh at, but I have no idea why you
laugh because it's far less trouble than your manual approach.


There's nothing wrong with using an ad blocker; it's just that it's a
limited solution to an overall problem that can also be solved in other
more general ways.

Anyone who uses the HOSTS file for ad blocking already knows the numerous
advantages and disadvantages of the ad blocker solution but the opposite
isn't always true.

That's why Mayayana and I chuckle when we hear people extolling the ease of
their ad-blocker solution, without saying that they understand the power
and portability of the hosts solution.

installed an ad blocker 5-6 years ago and haven't really touched it
since. It updates itself and I very rarely see an ad, without requiring
anything from me. The best part is that there are no holes in pages
where ads used to be. Last I checked, that was a big problem for
hosts-based solutions.


Each ad-blocking use model has its advantages and disadvantages.

Do you know how many different browsers & platforms I use?
Installing ad blockers on each wouldn't fit my flexible use model.

If it fits yours, that's fine, because it works for millions of others.

I don't have that requirement, so that probably tips things in your
direction. It wouldn't be a factor here. In fact, on a second computer I
simply installed the same ad blocker, so from that point I was covered
there, as well.


The ad blocker solution is completely different from the hosts solution.
The hosts solution is more portable across browsers and platforms.
The ad blocker solution is probably easier for most people to deal with.
  #48  
Old July 12th 17, 12:49 PM posted to alt.comp.os.windows-10
Lionel Muller
external usenet poster
 
Posts: 119
Default What is the easiest way to edit the hosts file on Windows as admin?

For alt.comp.os.windows-10 Char Jackson wrote:

You've already spent a lot of time arriving at the one-click solution
that you were seeking, but I don't care if it takes one click or 3
clicks. I don't edit system files on a regular basis so it simply
doesn't matter. How many seconds per year would I save, and what would I
do with them? I'd probably look out the window. :-)


You don't measure the time spent learning as a negative, but you do measure
the resulting efficiency for the next decade as a positive.

It's likely that...
1. Those who don't use the App Paths trick are likely less efficient.
2. Those who don't use the command-as-admin trick are less efficient.
3. Those who don't use the "cmd /K or /C" trick are less efficient.
etc.

The whole point of learning a Windows trick is to re-purpose that trick to
solve problems that nobody has ever solved before (to our knowledge).

If the solution was already written up and widely available, one of us
would have found it by now. So we broke new ground in this thread (and
that's not wasted learning).

We can re-purpose all the tricks we learned for future efficiency.
  #49  
Old July 12th 17, 12:49 PM posted to alt.comp.os.windows-10
Lionel Muller
external usenet poster
 
Posts: 119
Default What is the easiest way to edit the hosts file on Windows as admin?

For alt.comp.os.windows-10 Char Jackson wrote:

Nope, not at all. In fact, I raced ahead to the same place where you
ended up, thinking where else could I use this and wondering if this is
something I need. I very quickly determined that it is not, but I can
clearly see how important it is to you and I don't fault you for that.
Everyone has things that they deem to be important.


C'mon. You didn't even know the answer to the question (nobody had an
answer that worked), and now you imply by saying "you raced ahead" that you
knew all along the elegant solution.

I can tell just by your attitude that you'll never know Windows well
because you don't even understand that any solution to one problem has
implications for solving other problems.

The general method we came up with together on this ng solves multiple
problems simultaneously, such as
1. It solves the problem of lack of default filetype assignment
2. It solves the problem of administrator access
3. It solves the problem of deeply buried files
4. It solves the problem of PATH variables not needing to be set
5. It solves the problem of permission attributes not needed
6. It keeps the desktop pristine clean
7. It fits easily in the start menu
8. It becomes its own command (Start Run command)

I don't think you are actually as closed-minded as your statements imply
though, but if you think the solution only works for a single file on
Windows, then you are really just saying you're locked up inside a box of
your own making.

The solution we came up with, together (mostly re-purposed from the
command-as-admin thread) is a GENERAL solution to such problems, whether
you can see that from inside your closed-minded box or not.
  #50  
Old July 12th 17, 12:58 PM posted to alt.comp.os.windows-10
Lionel Muller
external usenet poster
 
Posts: 119
Default What is the easiest way to edit the hosts file on Windows as admin?

For alt.comp.os.windows-10 Lionel Muller wrote:

The solution we came up with, together (mostly re-purposed from the
command-as-admin thread) is a GENERAL solution to such problems, whether
you can see that from inside your closed-minded box or not.


BTW, if it was you who had suggested the rather elegant solution to the
command-as-admin problem, then you DID know the solution to the problem!

Which I appreciate, since all I did was re-purpose that solution to this
problem set.

Old problem set:
- Open command window as admin
- Without cluttering up the desktop
- In a single action

SOLUTION: Start Run cmda

New problem set:
- Edit an extensionless file as root
- Without cluttering up the desktop
- In a single action

SOLUTION: Start Run hosts

Both solutions make use of the "App Paths" trick and the
"shortcut-as-admin" trick, and the "cmd /K or /C" trick.

Combining those three tricks was the secret sauce since most people who
aren't innovative thinkers simply click about to find the file and then
right click to save it after changing the permissions or opening Notepad as
admin (which is the inefficient solution anyone can come up with).

Together we came up with an efficient elegant solution!
Start Run cmda (opens up a command window as administrator)
Start Run hosts (edits the hosts file as administrator)
  #51  
Old July 12th 17, 01:02 PM posted to alt.comp.os.windows-10
Lionel Muller
external usenet poster
 
Posts: 119
Default What is the easiest way to edit the hosts file on Windows as admin?

For alt.comp.os.windows-10 Lionel Muller wrote:


Anyone who uses the HOSTS file for ad blocking already knows the numerous
advantages and disadvantages of the ad blocker solution but the opposite
isn't always true.


This same logic can be applied to anyone who uses the right click edit as
administrator method to edit the HOSTS file.

Anyone who uses the single-step efficient method we came up with here
already knows about the much less efficient click-click-click-click method
of editing the hosts file that anyone can come up with, but those who use
the click-click-click-click method probably do not know this elegant
single-step method which is clean and efficient and elegant.

Start Run hosts
or
Start Programs hosts
  #52  
Old July 12th 17, 01:14 PM posted to alt.comp.os.windows-10,microsoft.public.scripting.vbscript
Mayayana
external usenet poster
 
Posts: 6,438
Default What is the easiest way to edit the hosts file on Windows as admin?

** Posted in VBS group from a HOSTS file
discussion in Win10 group. **

"Auric__" wrote
| Mayayana wrote:
|
| I have a VBS file I keep on my Desktop. When I
| visit a page that I think may have new muck I
| download the webpage, drop it on the script, which
| then parses the page for URLs and shows me a
| list. I can select any on the list to be added to
| both HOSTS files, cancel, and/or add other URLs.
|
| Would you be willing to post that script over in
| microsoft.public.scripting.vbscript ?
|

http://www.jsware.net/jsware/browsertips.php5#host

The download there (hosts.zip) is a package designed
to provide a basic primer about HOSTS files for people
concerned about privacy.

There are two versions, one for IE and one for other
browsers. The "iebut" subfolder has scripts and icons.
I wrote this some time ago. I don't know which version
of IE breaks it. Probably 11, which breaks IE-specific
functions. But I don't really know. It also predates IE
tabs, assuming there's just one actual browser window
of the IE variety running.
The IE package takes advantage of the ability to
add a custom button to the IE toolbar that then links to
a script. When you click the button, the script uses
Shell.Application to get the collection of Explorer/IE
windows, finds an IE instance, gets the document
content, and parses that. So it's a one-click approach.

If you wanted to use that I guess you might need
to edit the code to step down into the browser window
collection. I don't remember exactly how it works now.
I think the actual IE browser windows are embedded
inside windows of class IEFrame or some such. And I
don't know how the ShellApp.Windows collection deals
with that. But I suppose very few people care about
HOSTS and also use IE these days, anyway.

The CollectURLs script is for use with other browsers,
or any webpage. Use File - SaveAs to get the webpage.
Drop the HTML file onto the script. It gets parsed to find
URLs. It's not perfect and could probably be improved.
The code just looks for ".com", ".net", etc. Many pages
now are mostly obfuscated javascript and sleazy
URLs are often obfuscated, assembled by script rather
than written in the page HTML. The script won't catch those.
It can still be handy, though; a lot easier than trying to
read the source code.
After parsing the page content it pops up a window
with a list of URLs found. The list can be edited, aded to,
or even just used to add a new URL instead of editing
HOSTS by hand.
I added Acrylic HOSTS to my version. For anyone with
experience scripting that would be easy to do. Around
line 160-ish the script adds the new URLs to HOSTS.
The same code can be repeated to do the same for
Acrylic HOSTS.

A final caveat: As has been touched on in this thread,
later versions of Windows can be a pain in the neck with
file restrictions. If you don't turn off UAC you can't drop
files onto VBS because there's no way to elevate. Also,
many AV programs now monitor HOSTS and may complain
or block editing. Maybe something like Lionel's approach
of clearing restrictions via BAT file first would work. I've
never tried that.


  #53  
Old July 12th 17, 01:31 PM posted to alt.comp.os.windows-10,microsoft.public.scripting.vbscript
Lionel Muller
external usenet poster
 
Posts: 119
Default What is the easiest way to edit the hosts file on Windows as admin?

For alt.comp.os.windows-10,microsoft.public.scripting.vbscript Mayayana
wrote:

many AV programs now monitor HOSTS and may complain or block editing.


That admonishement reminded me that I should mention that the solution we
came up with for editing the hosts file using:
Start Run hosts
or
Start Programs hosts
Does cause "Glasswire" to pop up a temporary notification that a system
file was changed, which is actually a good thing because it ensures me that
the change took place.

The beauty of this method is that it doesn't clutter the desktop with
shortcuts, and it works in a single step from the Start menu (by multiple
ways) which is how I like an elegant clean efficient system to be.
  #54  
Old July 12th 17, 02:26 PM posted to alt.comp.os.windows-10
Lionel Muller
external usenet poster
 
Posts: 119
Default What is the easiest way to edit the hosts file on Windows as admin?

For alt.comp.os.windows-10 Mayayana wrote:


Meanwhile,
HOSTS will block the ads without trouble,
AND can be used to stop trackers. (Though
it is true that you might have to lift a finger to
use the HOSTS approach.


I agree with you that the best bang for the buck is just downloading *any*
reputable hosts file, and just copying over a new one about once a year (or
whatever).

While installing ad blockers is easy, copying a file is even easier than
installing an ad blocker - so nobody can argue that it's too much work by
way of comparison.

Besides, that single step works for *all* programs all the time on all
platforms.

If someone argues that browser-specific ad blockers are more efficient than
hosts-file blockers, I'd say they probably don't understand the HOSTS file
mechanism. (Your Acrylic DNS system is even better.)

And even so, there's nothing stopping them from adding ad blockers to the
host blocker (but I doubt it's needed).
  #55  
Old July 12th 17, 03:55 PM posted to alt.comp.os.windows-10,microsoft.public.scripting.vbscript
Dave \Crash\ Dummy
external usenet poster
 
Posts: 1,149
Default What is the easiest way to edit the hosts file on Windows asadmin?

Mayayana wrote:
** Posted in VBS group from a HOSTS file discussion in Win10 group.
**


What is the name of the Win10 group? My search of Usenet group names for
"win10" comes up empty. I can use all the help I can get with Windows 10!
--
Crash

If the donation is not anonymous, it's not charity, it's advertising.
  #56  
Old July 12th 17, 04:25 PM posted to alt.comp.os.windows-10,microsoft.public.scripting.vbscript
Sam Hill
external usenet poster
 
Posts: 147
Default What is the easiest way to edit the hosts file on Windows asadmin?

On Wed, 12 Jul 2017 10:55:41 -0400, Dave \"Crash\" Dummy wrote:

Mayayana wrote:
** Posted in VBS group from a HOSTS file discussion in Win10 group.
**


What is the name of the Win10 group? My search of Usenet group names for
"win10" comes up empty. I can use all the help I can get with Windows
10!


Take a closer look at the header of the message you replied to (and this
one as well)- specifically the "Newsgroups" header item.
  #57  
Old July 12th 17, 06:01 PM posted to alt.comp.os.windows-10,microsoft.public.scripting.vbscript
Mayayana
external usenet poster
 
Posts: 6,438
Default What is the easiest way to edit the hosts file on Windows as admin?

"Dave "Crash" Dummy" wrote

| What is the name of the Win10 group? My search of Usenet group names for
| "win10" comes up empty. I can use all the help I can get with Windows 10!

Don't you see it in your reply?

alt.comp.os.windows-10

There's no MS group, as they abandoned their
usenet servers and switched over to the moderated
Web forums before Win10 came out.
I get this group through Eternal September. It
should be provided by most servers.


  #58  
Old July 12th 17, 06:11 PM posted to alt.comp.os.windows-10
Good Guy[_2_]
external usenet poster
 
Posts: 3,354
Default What is the easiest way to edit the hosts file on Windows asadmin?

On 12/07/2017 14:26, Lionel Muller wrote:

I agree with you that the best bang for the buck is just downloading
*any*
reputable hosts file, and just copying over a new one about once a
year (or
whatever).



First thing there is no such thing as "reputable hosts file". Name me one.

Second, you haven't told us what exactly are you trying to block? Don't
tell me Ads because ads are not a problem for people doing legitimate
work on their computer. The list of website I visit is almost limited
and I don't have any problems about ads.

Amazon
BBC
Microsoft
Mozilla
Embarcadero
Adobe
Techsmith
Yahoo
Gmail/Google
HMRC
KPMG (my own firm)
PWC
E&Y
ICAEW
CIOT

That's it basically and I don't see any problems with any of them.

How can you get any time to visit other websites? what about your
full-time employment? Does it not take priority?

--
With over 500 million devices now running Windows 10, customer
satisfaction is higher than any previous version of windows.

  #59  
Old July 12th 17, 06:54 PM posted to alt.comp.os.windows-10
Lionel Muller
external usenet poster
 
Posts: 119
Default What is the easiest way to edit the hosts file on Windows as admin?

For alt.comp.os.windows-10 Good Guy wrote:


First thing there is no such thing as "reputable hosts file". Name me one.

I did already.
Many times in this thread.
Here they are again.
http://winhelp2002.mvps.org/hosts.txt
http://someonewhocares.org/hosts/
https://github.com/StevenBlack/hosts
etc
Second, you haven't told us what exactly are you trying to block? Don't
tell me Ads because ads are not a problem for people doing legitimate
work on their computer. The list of website I visit is almost limited
and I don't have any problems about ads.


Just the first hosts file above has over fourteen thousand domains blocked.
Do you really want me to list all fourteen thousand in this response?

How can you get any time to visit other websites? what about your
full-time employment? Does it not take priority?


Based on that question, I think it may be that you completely misunderstand
that it takes only a second or two to download a hosts file and to replace
your original hosts file with that downloaded host file.
 




Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off






All times are GMT +1. The time now is 09:23 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.