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
  #31  
Old July 11th 17, 11:34 PM posted to alt.comp.os.windows-10
Char Jackson
external usenet poster
 
Posts: 10,449
Default What is the easiest way to edit the hosts file on Windows as admin?

On Tue, 11 Jul 2017 20:41:47 +0000 (UTC), Lionel Muller
wrote:

Every time I run into an obnoxious ad or web site, I add it to the hosts
file. Periodically, I cull the major reliable hosts files on the net and
run through a sort unique so that I can add all the new research.
http://winhelp2002.mvps.org/hosts.txt
http://someonewhocares.org/hosts/
https://github.com/StevenBlack/hosts
etc
Periodically I synchronize all the hosts files on my Linux, Windows, and
Android devices.


In another post just now, before I saw this one, I asked about the kinds
of edits you make in a typical day. Thanks to the above, I have my
answer. FWIW, I absolutely won't be following you down this road. ;-)

Ads
  #32  
Old July 11th 17, 11:40 PM posted to alt.comp.os.windows-10
Char Jackson
external usenet poster
 
Posts: 10,449
Default What is the easiest way to edit the hosts file on Windows as admin?

On Tue, 11 Jul 2017 12:38:36 -0700, Ken Blake
wrote:

On Tue, 11 Jul 2017 13:38:29 -0500, Char Jackson
wrote:

On Tue, 11 Jul 2017 17:48:32 +0000 (UTC), Lionel Muller
wrote:

Since editing the hosts file is done scores of times every day, snip


I'm sure you realize that the number of people doing what you're doing
is tiny, tiny, tiny. :-)

I'd bet that most Windows users *never* edit their hosts file.



Right, by far!

But I'll go even farther: I'll bet that most Windows users have no
idea what the hosts file is.

And farther still: I'll bet that most Windows users have *never* even
heard of the hosts file.


I agree completely. Sometimes you correctly point out, though, that each
of us uses his/her computer in somewhat unique ways. I don't spend any
time at all with my hosts files, but I guess some others do. Not many
others, but still some.

  #33  
Old July 11th 17, 11:40 PM posted to alt.comp.os.windows-10
Mayayana
external usenet poster
 
Posts: 6,438
Default What is the easiest way to edit the hosts file on Windows as admin?

"Lionel Muller" wrote

| Anyone can edit the hosts file in a series of clicks, but it takes an
| expert to do it in one click.
|
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.

The catch: I'm on WinXP and don't put up with
no stinkin' file restrictions. I expect the script
would also work on Win7 with UAC disabled. Maybe
also on Win10? If not then you might consider
removing file restrictions from HOSTS. Of course,
many people will say that's crazy. There's a case
to be made both ways. But you can't lock down
everything and still expect convenience.

As for your script, I'm not sure. I don't do DOS
and I don't get what you're doing there. You seem to
be trying to use VBS COM operations in BAT files. ?


  #34  
Old July 12th 17, 12:48 AM 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:


I agree completely. Sometimes you correctly point out, though, that each
of us uses his/her computer in somewhat unique ways. I don't spend any
time at all with my hosts files, but I guess some others do. Not many
others, but still some.


You seem to be thinking the solution has only one application, but by
keeping yourself locked tightly inside the box, you miss the elegance of
the general-purpose solution set.

The general-use point here is that it's easy, if you know a handful of
Windows tricks, to edit ANY file in a single click, and by the "start run"
command line even if that file needs to be edited as admin and even if that
file has no default application, and even if the editor isn't in the PATH.
  #35  
Old July 12th 17, 12:48 AM 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:


Periodically I synchronize all the hosts files on my Linux, Windows, and
Android devices.


In another post just now, before I saw this one, I asked about the kinds
of edits you make in a typical day. Thanks to the above, I have my
answer. FWIW, I absolutely won't be following you down this road. ;-)


You hurt my feelings because you completely missed the entire point.
Think about it a different way than you don't care about Windows 10 tricks.

Think about it as a Windows problem to solve of:
(a) How to edit a buried file using any editor in a single click
(b) Where that file has no filename extension
(c) And where you have to edit it as Administrator

Remember. Even now you probably can't edit any desired buried file in a
single click, even without the added restrictions of no default editing app
and having to be administrator.

You'll notice a handful of elegant tricks, from the App Paths trick to the
"cmd /c" trick to the shortcut-as-admin trick, so, if you do not follow me
down this path, that just means you don't care to understand windows (which
is fine).

But, what you're saying is what my kid says when I try to teach him
something useful such as decibels. He says he doesn't care about decibels.

That's all well and good - but - it means he (and you) can't learn anything
new, since the approach I used has NOTHING directly to do with the hosts
file itself.

It's a generally useful approach that has a handful of elegant tricks that
I'll wager my mortgage on that you were completely unaware of them.

In fact, EVERYONE here was completely unaware of these elegant Windows
tricks because NOBODY came up with the solution.

It's fine that I know this part of Windows better than all of you, but,
please don't deprecate that hard-won knowledge just because you don't care
about learning new tricks for editing any hard-to-edit file in one click.
  #36  
Old July 12th 17, 12:48 AM 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:


As for your script, I'm not sure. I don't do DOS
and I don't get what you're doing there. You seem to
be trying to use VBS COM operations in BAT files. ?


Thanks Mayayana as you and only one other person offered any meaningful
help (although to be more fair, a few others offered the standard help of
editing the file the way everyone already does but I was trying to improve
on what everyone does).

In the end, I solved it, almost on my own, which is to say that I
re-purposed the cmda.lnk method we used in the past few weeks to open up a
command window as admin in a single click.

So with hosts.lnk (being a shortcut to cmd.exe /C), I am easily able to
edit the hosts file in any desired editor, as administrator, in a single
click (not having to worry about the lack of a file-name extension which
Windows 10 lost the capability of doing).

To edit the hosts file in any desired editor as root, I just click
Start Progams hosts.lnk
Or
Start Run hosts return

Nowhere on the net is this documented, so, I wrote it up to give back to
the group and posted that tested tutorial about an hour ago.
  #37  
Old July 12th 17, 12:53 AM 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:


Think about it as a Windows problem to solve of:
(a) How to edit a buried file using any editor in a single click
(b) Where that file has no filename extension
(c) And where you have to edit it as Administrator


Think about it as a Windows problem to solve of:
(a) How to manually edit a buried file using any editor in a single step
(b) Where that file has no filename extension
(c) And where you have to edit it as Administrator
(d) And where nothing needs to be touched in the PATH variable

It's this simple to edit any file in a single step:

Start Run hosts
or
Start Programs hosts

If you know Windows well enough to make it even easier, please let me know
because this was always a question only for Windows experts.
  #38  
Old July 12th 17, 01:06 AM posted to alt.comp.os.windows-10
No_Name
external usenet poster
 
Posts: 47
Default What is the easiest way to edit the hosts file on Windows as admin?

On Tue, 11 Jul 2017 06:56:25 +0000 (UTC), Lionel Muller
wrote:

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

This "shortcut" method (which is almost exactly what we already used for
opening an admin command prompt) worked the very first time, but is there
an easier way to edit the hosts file?

Rightclick in any folder (e.g., the Desktop) New Shortcut
Type a location of "cmd" (or "cmd.exe") sans quotes
Click Next
Type an optional "name" (e.g., "Edit the hosts file")
Click Finish

Rightclick the new Shortcut Properties
Change the Shortcut Target from:
C:\Windows\System32\cmd.exe
Change the Shortcut Target to:
C:\Windows\System32\cmd.exe /K "notepad C:\Windows\System32\Drivers\etc\hosts"

Optionally change the "Start in" directory from:
C:\WINDOWS\system32
Optionally change the "Start in" directory to:
C:\WINDOWS\system32\Drivers\etc\

Press the Advanced button
Check [x]Run as Administrator
Press OK

That successfully creates a cascaded menu shortcut which will edit the
hosts file as administrator.

But is there an easier way?

I will outline the methods that failed, all modeled on the methods we
successfully used to open an admin prompt.
1. hotkey (failed)
2. shortcut (worked)
3. registry (failed)
4. batch file (failed)

The answer is generally useful to everyone so it would be worth our while
to solve this problem with the best solution possible.

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


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.


Beamer Smith
Out on a limb, sawing Madly

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

  #39  
Old July 12th 17, 01:51 AM posted to alt.comp.os.windows-10
Mayayana
external usenet poster
 
Posts: 6,438
Default What is the easiest way to edit the hosts file on Windows as admin?

"Lionel Muller" wrote

| I just laugh when I hear people suggesting ad blockers

I feel the same way. I consider a HOSTS file the single
most efficient device for both security and privacy
online, while also being the easiest.

I probably have no more than 300
entries in my HOSTS file and almost never see ads. It's
also a great way to block tracking by the likes of
googletagmanager and scorecardresearch... Which is owned
by markmonitor, the copyright protection company... which
was bought by Thomson Reuters, and is very widespread
online. Those two alone are on the vast majority of
commercial sites. They typically track visitors through script
but even set up image web bugs in NOSCRIPT tags. Often
those are in IFRAMES, to allow 1st-party cookies and cross-site
scripting. Ditto with Facebook. Maybe some ad blockers stop
those? I don't know. I don't need an ad blocker. I don't
understand why so many knowledgeable people think they
do need an adblocker.

Just last week I was having lunch with a very non-techie
Mac user. He was almost whining in asking me if there were
any way to possibly reduce the ads and nonsense online.
I sent him a link to set up a HOSTS file. I don't know
whether he'll be able to handle it. Macs, being restricted,
apparently require a series of arcane incantations to manage
the HOSTS file. But I told him to call me if need be and I'd
walk him through it. I do the same for everyone who's
computer I work on, putting in a HOSTS file along with cleanup
and setup work. I think of it as part of having a fully functional
computer. If they don't understand it I just give them a
basic version, so as not to inadvertently block captchas
or other things they might want. It's almost effortless:
Add a few dozen of the worst spying and advertising
companies and suddenly the Internet looks civilized. It's
also a lot safer, given that rigged ads have become a
common malware venue.

Those people need never know nor understand how all
the ads stopped. And they'd never be able to handle an
ad blocker that needed any kind of oversight or interaction.
They're just glad the ads are gone.


  #40  
Old July 12th 17, 05:01 AM posted to alt.comp.os.windows-10
Char Jackson
external usenet poster
 
Posts: 10,449
Default What is the easiest way to edit the hosts file on Windows as admin?

On Tue, 11 Jul 2017 23:48:00 +0000 (UTC), Lionel Muller
wrote:

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


I agree completely. Sometimes you correctly point out, though, that each
of us uses his/her computer in somewhat unique ways. I don't spend any
time at all with my hosts files, but I guess some others do. Not many
others, but still some.


You seem to be thinking the solution has only one application, but by
keeping yourself locked tightly inside the box, you miss the elegance of
the general-purpose solution set.

The general-use point here is that it's easy, if you know a handful of
Windows tricks, to edit ANY file in a single click, and by the "start run"
command line even if that file needs to be edited as admin and even if that
file has no default application, and even if the editor isn't in the PATH.


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. :-)

  #41  
Old July 12th 17, 05:58 AM posted to alt.comp.os.windows-10
Char Jackson
external usenet poster
 
Posts: 10,449
Default What is the easiest way to edit the hosts file on Windows as admin?

On Tue, 11 Jul 2017 23:48:02 +0000 (UTC), Lionel Muller
wrote:

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


Periodically I synchronize all the hosts files on my Linux, Windows, and
Android devices.


In another post just now, before I saw this one, I asked about the kinds
of edits you make in a typical day. Thanks to the above, I have my
answer. FWIW, I absolutely won't be following you down this road. ;-)


You hurt my feelings because you completely missed the entire point.


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.

  #42  
Old July 12th 17, 06:00 AM posted to alt.comp.os.windows-10
Char Jackson
external usenet poster
 
Posts: 10,449
Default What is the easiest way to edit the hosts file on Windows as admin?

On Tue, 11 Jul 2017 23:48:03 +0000 (UTC), Lionel Muller
wrote:

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


As for your script, I'm not sure. I don't do DOS
and I don't get what you're doing there. You seem to
be trying to use VBS COM operations in BAT files. ?


Thanks Mayayana as you and only one other person offered any meaningful
help (although to be more fair, a few others offered the standard help of
editing the file the way everyone already does but I was trying to improve
on what everyone does).

In the end, I solved it, almost on my own, which is to say that I
re-purposed the cmda.lnk method we used in the past few weeks to open up a
command window as admin in a single click.


Thanks for mentioning that. As I recall, I was the first to offer the
help text for that command, so I'm glad that you found it helpful. :-)

  #43  
Old July 12th 17, 08:32 AM posted to alt.comp.os.windows-10
Auric__
external usenet poster
 
Posts: 295
Default What is the easiest way to edit the hosts file on Windows as admin?

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 ?

--
To my lawyer, I leave, not a boot to the head,
but a rabid Tasmanian devil, to be placed in his trousers.
  #44  
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:


In the end, I solved it, almost on my own, which is to say that I
re-purposed the cmda.lnk method we used in the past few weeks to open up a
command window as admin in a single click.


Thanks for mentioning that. As I recall, I was the first to offer the
help text for that command, so I'm glad that you found it helpful. :-)


I don't remember who it was that helped in the command-as-admin thread, so
if it was you, I'm EXTREMELY THANKFUL that you offered the advice that
solved that problem.

IMHO, most Windows experts re-purpose existing solutions to match the
different requirements of the next problem set.

That's all we did (together) to solve this problem set:
1. The goal is always single click efficiency by multiple methods
2. The file is buried in a lousy place which is wasteful to shortcut
3. The filename had no extension, hence no default editing application
4. The file itself has to be edited with administrator privileges
5. The solution requires no changes to the PATH variable
  #45  
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 Mayayana wrote:

I feel the same way. I consider a HOSTS file the single
most efficient device for both security and privacy
online, while also being the easiest.


I agree with you that the HOSTS file is a great way to easily block
specific obnoxious sites from ALL the computers you own for the rest of
your life, including mobile devices.

It's really not much effort if you use the standard ones.
For example, the MVP Hosts file is well known, but there are a few others
out there, not only restricted to the list I provided.
http://winhelp2002.mvps.org/hosts.txt
http://someonewhocares.org/hosts/
https://github.com/StevenBlack/hosts
etc

Interestingly, I added a rooted ad blocker app to my android phone which
edited the hosts file on Android, giving me a really good list of
ad-blocking sites to transfer over to Windows over the WiFi LAN.

I use Linux to sort unique because I don't know if there are Windows
commands yet that can easily combine lists using regular expressions so
that the comments are ignored.

I probably have no more than 300
entries in my HOSTS file and almost never see ads.


Yup. And it works for all your devices, forever.
And it stops a lot of spyware sites too!

It's
also a great way to block tracking by the likes of
googletagmanager and scorecardresearch...


Yup. Why there were people deprecating the HOSTS file was beyond me, but I
simply assume they don't actually understand the problem set and the
effected solution.

I don't need an ad blocker. I don't
understand why so many knowledgeable people think they
do need an adblocker.


I'm with you.
The problem with ad blockers is that they are so much work to get so little
benefit compared to simply editing the hosts file (or using Acrylic DNS and
using regular expressions).

Those people need never know nor understand how all
the ads stopped. And they'd never be able to handle an
ad blocker that needed any kind of oversight or interaction.
They're just glad the ads are gone.


I'm with you.
Editing the hosts file is one of the best ways to enjoy the Internet
without being annoyed, or tracked, and it speeds up browsing to boot, which
wasn't even the original purpose.
 




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 07:17 PM.


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