Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.comp.os.windows-10 > #47518 > unrolled thread

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

Started byLionel Muller <Erhohterlowe@neomailbox.com>
First post2017-07-11 06:56 +0000
Last post2017-07-12 19:00 +0000
Articles 20 on this page of 73 — 17 participants

Back to article view | Back to alt.comp.os.windows-10


Contents

  What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-11 06:56 +0000
    Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-11 07:07 +0000
    Re: What is the easiest way to edit the hosts file on Windows as admin? "Auric__" <not.my.real@email.address> - 2017-07-11 07:33 +0000
    Re: What is the easiest way to edit the hosts file on Windows as admin? Lucifer Morningstar <not@for.mail> - 2017-07-11 17:44 +1000
      Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-11 17:19 +0000
    Re: What is the easiest way to edit the hosts file on Windows as admin? Zeezicht <zeezicht_adelin.remove@telenet.remove.be> - 2017-07-11 11:23 +0200
      Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-11 17:19 +0000
    Re: What is the easiest way to edit the hosts file on Windows as admin? "s|b" <me@privacy.invalid> - 2017-07-11 13:49 +0200
      Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-11 17:19 +0000
    Re: What is the easiest way to edit the hosts file on Windows as admin? slate_leeper <bycy-r0bj@spamex.com> - 2017-07-11 09:15 -0400
      Re: What is the easiest way to edit the hosts file on Windows as admin? Mike Tomlinson <mike@jasper.org.uk> - 2017-07-11 16:33 +0100
        Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-11 17:29 +0000
    Re: What is the easiest way to edit the hosts file on Windows as admin? "Mayayana" <mayayana@invalid.nospam> - 2017-07-11 09:43 -0400
      Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-11 17:36 +0000
        Re: What is the easiest way to edit the hosts file on Windows as admin? "Mayayana" <mayayana@invalid.nospam> - 2017-07-11 18:40 -0400
          Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-11 23:48 +0000
            Re: What is the easiest way to edit the hosts file on Windows as admin? Char Jackson <none@none.invalid> - 2017-07-12 00:00 -0500
              Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-12 11:49 +0000
          Re: What is the easiest way to edit the hosts file on Windows as admin? "Auric__" <not.my.real@email.address> - 2017-07-12 07:32 +0000
            Re: What is the easiest way to edit the hosts file on Windows as admin? "Mayayana" <mayayana@invalid.nospam> - 2017-07-12 08:14 -0400
              Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-12 12:31 +0000
              Re: What is the easiest way to edit the hosts file on Windows as admin? "Dave \"Crash\" Dummy" <invalid@invalid.invalid> - 2017-07-12 10:55 -0400
                Re: What is the easiest way to edit the hosts file on Windows as admin? Sam Hill <sam@example.com> - 2017-07-12 15:25 +0000
                  Re: What is the easiest way to edit the hosts file on Windows as admin? "Dave \"Crash\" Dummy" <invalid@invalid.invalid> - 2017-07-12 18:41 -0400
                Re: What is the easiest way to edit the hosts file on Windows as admin? "Mayayana" <mayayana@invalid.nospam> - 2017-07-12 13:01 -0400
                  Re: What is the easiest way to edit the hosts file on Windows as admin? "Dave \"Crash\" Dummy" <invalid@invalid.invalid> - 2017-07-12 18:46 -0400
                Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-12 17:46 +0000
    Re: What is the easiest way to edit the hosts file on Windows as admin? Big Al <BigAl@invalid.com> - 2017-07-11 10:37 -0400
      Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-11 17:19 +0000
    Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-11 17:48 +0000
      Re: What is the easiest way to edit the hosts file on Windows as admin? Char Jackson <none@none.invalid> - 2017-07-11 13:38 -0500
        Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-11 19:11 +0000
          Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-11 20:41 +0000
            Re: What is the easiest way to edit the hosts file on Windows as admin? Char Jackson <none@none.invalid> - 2017-07-11 17:34 -0500
              Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-11 23:48 +0000
                Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-11 23:53 +0000
                Re: What is the easiest way to edit the hosts file on Windows as admin? Char Jackson <none@none.invalid> - 2017-07-11 23:58 -0500
                  Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-12 11:49 +0000
                    Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-12 11:58 +0000
                      Re: What is the easiest way to edit the hosts file on Windows as admin? Char Jackson <none@none.invalid> - 2017-07-12 13:37 -0500
                        Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-12 19:00 +0000
              Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-13 22:34 -0700
                Re: What is the easiest way to edit the hosts file on Windows as admin? Paul <nospam@needed.invalid> - 2017-07-14 02:10 -0400
                  Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-14 07:43 -0700
                  Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-14 12:12 -0700
            Re: What is the easiest way to edit the hosts file on Windows as admin? "Mayayana" <mayayana@invalid.nospam> - 2017-07-11 20:51 -0400
              Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-12 11:49 +0000
          Re: What is the easiest way to edit the hosts file on Windows as admin? Char Jackson <none@none.invalid> - 2017-07-11 17:27 -0500
            Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-11 23:48 +0000
              Re: What is the easiest way to edit the hosts file on Windows as admin? Char Jackson <none@none.invalid> - 2017-07-11 23:52 -0500
                Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-12 11:49 +0000
                  Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-12 12:02 +0000
                Re: What is the easiest way to edit the hosts file on Windows as admin? "Mayayana" <mayayana@invalid.nospam> - 2017-07-12 09:15 -0400
                  Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-12 13:26 +0000
                    Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-12 17:54 +0000
                      Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-12 23:48 +0200
                      Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-12 21:54 +0000
                      Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-12 23:10 +0100
        Re: What is the easiest way to edit the hosts file on Windows as admin? Ken Blake <Ken@invalid.news.com> - 2017-07-11 12:38 -0700
          Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-11 19:49 +0000
          Re: What is the easiest way to edit the hosts file on Windows as admin? Char Jackson <none@none.invalid> - 2017-07-11 17:40 -0500
            Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-11 23:48 +0000
              Re: What is the easiest way to edit the hosts file on Windows as admin? Char Jackson <none@none.invalid> - 2017-07-11 23:01 -0500
                Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-12 11:49 +0000
      Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-11 20:41 +0000
    Re: What is the easiest way to edit the hosts file on Windows as admin? jetjock <jetjock@example.com> - 2017-07-11 13:56 -0500
      Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-11 19:11 +0000
      Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-11 20:41 +0000
    Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-11 20:59 +0000
    Re: What is the easiest way to edit the hosts file on Windows as admin? Gralber@grelberville.org - 2017-07-11 20:06 -0400
      Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-12 11:49 +0000
      Re: What is the easiest way to edit the hosts file on Windows as admin? Nomen Nescio <nobody@dizum.com> - 2017-07-12 20:04 +0200
        Re: What is the easiest way to edit the hosts file on Windows as admin? Lionel Muller <Erhohterlowe@neomailbox.com> - 2017-07-12 19:00 +0000

Page 1 of 4  [1] 2 3 4  Next page →


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

FromLionel Muller <Erhohterlowe@neomailbox.com>
Date2017-07-11 06:56 +0000
SubjectWhat is the easiest way to edit the hosts file on Windows as admin?
Message-ID<ok1sqo$1llk$1@gioia.aioe.org>
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?

[toc] | [next] | [standalone]


#47519

FromLionel Muller <Erhohterlowe@neomailbox.com>
Date2017-07-11 07:07 +0000
Message-ID<ok1tg9$1moi$1@gioia.aioe.org>
In reply to#47518
For alt.comp.os.windows-10,alt.windows7.general Lionel Muller wrote:

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

For whatever reason, the batch file method failed.
Here is the batch file that works for opening a command prompt as admin.
===================
@ECHO OFF

REM Open a new shell "Run As Administrator"
REM Based on script by foxidrive on alt.msdos.batch

SETLOCAL ENABLEEXTENSIONS

IF NOT "%~1"=="" goto :START

SET MyFile=%TEMP%\Admin.vbs"
Echo Set UAC = CreateObject("Shell.Application") >"%MyFile%"
Echo UAC.ShellExecute "%~f0", "%cd%", "", "runas", 1 >>"%MyFile%"
Start "" /MIN "%MyFile%"
goto :EOF

:START
Cmd /k "CD /D "%*" & Echo Administrator: & color 4F"\
===================
I wasn't able to modify that batch file to edit the hosts file as admin.
===================
@ECHO OFF
SET MyFile=%TEMP%\C:\Windows\System32\Drivers\etc\hosts"
Echo Set UAC = CreateObject("Shell.Application") >"%MyFile%"
Echo UAC.ShellExecute "%~f0", "%cd%", "", "runas", 1 >>"%MyFile%"
Start "" /MIN "notepad.exe %MyFile%"
===================
What did I do wrong above?

The answer would be generally useful to everyone.
Do you know how to modify that batch file to open hosts as admin?

[toc] | [prev] | [next] | [standalone]


#47527

From"Auric__" <not.my.real@email.address>
Date2017-07-11 07:33 +0000
Message-ID<XnsA7AF65AE8F4Cauricauricauricauric@213.239.209.88>
In reply to#47518
Lionel Muller wrote:

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

Right-click notepad and select "Run as administrator", then File -> Open -> 
%WINDIR%\System32\Drivers\etc\hosts -> OK

-- 
Three angels follow me. The bright one bleeds power.
The dark one bleeds will. The smallest merely weeps.

[toc] | [prev] | [next] | [standalone]


#47529

FromLucifer Morningstar <not@for.mail>
Date2017-07-11 17:44 +1000
Message-ID<qd09mct6uc7ujsfrg74e4dsooa02cea02n@4ax.com>
In reply to#47518
On Tue, 11 Jul 2017 06:56:25 +0000 (UTC), Lionel Muller
<Erhohterlowe@neomailbox.com> wrote:

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

Notebook.

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

Notebook.

[toc] | [prev] | [next] | [standalone]


#47594

FromLionel Muller <Erhohterlowe@neomailbox.com>
Date2017-07-11 17:19 +0000
Message-ID<ok31a7$1ife$1@gioia.aioe.org>
In reply to#47529
For alt.comp.os.windows-10 Lucifer Morningstar wrote:


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

I apologize for not making it clear that this is a question only Windows
experts can answer, which is how to edit the hosts file as admin in a
single click.

I googled what you were trying to say but Notbook is hardware as far as I
can tell so you must know something I don't know about "notebook".

If you meant "notepad", that's just an editor, so it's not a method,
although the editor will be what is used.

As Auric_ stated, without even thinking, one "could" use Notepad and click
click click click click click etc., to open the hosts file which is
embedded in the Windows hierarchy, but if that's what I wanted to do, I
never would have asked you experts for advice since even my 85 year old
mother knows how to do that.

What we're looking for is one-click efficiency.
What would be best would be to create a registry command:
 Start > Run > hosts <ENTER>
And that would edit the hosts file as admin.

But I can't get the App Paths key to do that yet.
HKLM/SOFTWARE/Microsoft/Windows/CurrentVersion/App Paths/hosts.exe
Default = "notepad.exe C:\Windows\System32\Drivers\etc\hosts"

That would work just fine if Windows wasn't stupid when it comes to files
sans extension, for example, this works perfectly to edit the file (but not
as admin):
HKLM/SOFTWARE/Microsoft/Windows/CurrentVersion/App Paths/hosts.exe
Default = "C:\Windows\System32\Drivers\etc\hosts.txt"

So the trick I am asking of Windows experts is what registry key to add
that will edit the hosts file as admin?

[toc] | [prev] | [next] | [standalone]


#47538

FromZeezicht <zeezicht_adelin.remove@telenet.remove.be>
Date2017-07-11 11:23 +0200
Message-ID<mn.5aab7e17f12d6fb8.136366@telenet.remove.be>
In reply to#47518
Lionel Muller stelde de volgende uitleg voor :
> 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?

Hi, Try HOSTSMAN ==>  http://www.abelhadigital.com/hostsman
It has a very userfriendly "editor" onboard + other features ...

-- 
Mvg, Adelin

[toc] | [prev] | [next] | [standalone]


#47595

FromLionel Muller <Erhohterlowe@neomailbox.com>
Date2017-07-11 17:19 +0000
Message-ID<ok31a8$1ife$2@gioia.aioe.org>
In reply to#47538
For alt.comp.os.windows-10 Zeezicht wrote:


>> What is the quickest way to edit the hosts file on Windows as admin?
> 
> Hi, Try HOSTSMAN ==>  http://www.abelhadigital.com/hostsman
> It has a very userfriendly "editor" onboard + other features ...

I appreciate the suggestion to use "hostman" as the hosts editor.
http://www.abelhadigital.com/hostsman

"HostsMan is a freeware application that lets you manage your Hosts file
with ease."

I'm already using the MVP HOSTS file so it would have to work with that.
http://winhelp2002.mvps.org/hosts.txt

If I fail to edit the hosts file as admin in a single step, then I will
resort to adding non-native software to Windows, but for now, I'm going to
keep this method in our back pocket to use only if the experts here fail to
be able to edit the hosts file as admin in a click or two at most.

But I apologize for not making it clear that the goal is one-click admin
editing of the Windows hosts file using native Windows tricks of the trade.

[toc] | [prev] | [next] | [standalone]


#47548

From"s|b" <me@privacy.invalid>
Date2017-07-11 13:49 +0200
Message-ID<esjsauFr8dfU1@mid.individual.net>
In reply to#47518
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?

What's wrong with opening Explorer, go to directory

C:\Windows\System32\Drivers\etc\hosts

open HOSTS with Notepad, edit, save, done?

-- 
s|b

[toc] | [prev] | [next] | [standalone]


#47596

FromLionel Muller <Erhohterlowe@neomailbox.com>
Date2017-07-11 17:19 +0000
Message-ID<ok31aa$1ife$3@gioia.aioe.org>
In reply to#47548
For alt.comp.os.windows-10 s|b wrote:


>> What is the quickest way to edit the hosts file on Windows as admin?
> 
> What's wrong with opening Explorer, go to directory
> 
> C:\Windows\System32\Drivers\etc\hosts
> 
> open HOSTS with Notepad, edit, save, done?

I apologize that I wasn't clear that anyone can edit the hosts file as
admin using multiple steps.

So it's a good question to ask why the "obvious" method that every Mom and
Pop already knows isn't good enough.

Admittedly this is a question only a Windows expert could answer because
the goal is to edit the hosts file in a single click.

The reason is that I edit the hosts file constantly, every day, where my
current hosts file is about 30,000 lines long (yes, I know about Acrylic
DNS).

Anyone can edit the hosts file as admin using multiple clicks.
The goal is to edit the hosts file as admin in a single click.
A windows expert is probably needed to achieve that goal.

[toc] | [prev] | [next] | [standalone]


#47560

Fromslate_leeper <bycy-r0bj@spamex.com>
Date2017-07-11 09:15 -0400
Message-ID<mnj9mc5k7dfed2ulh2mkn6e3g3revj0qbi@4ax.com>
In reply to#47518
On Tue, 11 Jul 2017 06:56:25 +0000 (UTC), Lionel Muller
<Erhohterlowe@neomailbox.com> wrote:

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

I put the hosts file on the desktop (Target:
E:\Windows\System32\drivers\etc\hosts)

Now I just right click on that icon and select "open with notepad."


-dan z-



-- 
Protect your civil rights!
Let the politicians know how you feel.
Join or donate to the NRA today! 
http://membership.nrahq.org/default.asp?campaignid=XR014887

Gun control is like trying to reduce drunk driving by making it tougher for sober people to own cars.

[toc] | [prev] | [next] | [standalone]


#47581

FromMike Tomlinson <mike@jasper.org.uk>
Date2017-07-11 16:33 +0100
Message-ID<q4m566BX$OZZFwRj@jasper.org.uk>
In reply to#47560
En el artículo <mnj9mc5k7dfed2ulh2mkn6e3g3revj0qbi@4ax.com>,
slate_leeper <bycy-r0bj@spamex.com> escribió:

>I put the hosts file on the desktop (Target:
>E:\Windows\System32\drivers\etc\hosts)
>
>Now I just right click on that icon and select "open with notepad."

A good tip.  Thanks.

-- 
 (\_/)
(='.'=)  "Between two evils, I always pick
(")_(")   the one I never tried before."  - Mae West

[toc] | [prev] | [next] | [standalone]


#47598

FromLionel Muller <Erhohterlowe@neomailbox.com>
Date2017-07-11 17:29 +0000
Message-ID<ok31u0$1jc7$1@gioia.aioe.org>
In reply to#47581
For alt.comp.os.windows-10 Mike Tomlinson wrote:


>>I put the hosts file on the desktop (Target:
>>E:\Windows\System32\drivers\etc\hosts)
>>
>>Now I just right click on that icon and select "open with notepad."
> 
> A good tip.  Thanks.

The goal is single click admin editing of the hosts file.
Only a Windows expert will know how to do this.

While I keep a perfectly clean desktop, I would put any links in the
cascaded menu, so that they work in a single click (although I prefer the
registry which is the simplest at 
 Start > Run > hosts <return>

I already have a shortcut adapted from the opening a command window as
administrator in my cascaded menu that works to edit the hosts file as
admin in a single click, but that menu shortcut also opens up a command
window which is an extra click to close.

In trying to understand your single-slick suggestion, you said you put the
"hosts" file on the desktop, and right clicked to edit it in Notepad, but I
think you missed a ton of steps because that doesn't edit the hosts file as
admin and put it back in without a txt extension.

You can force it to do that, but it's so many steps as to not qualify in
the least as a single-click menu solution.

But maybe I misunderstood what you were suggesting?
Can you clarify what I'm supposed to put in my menus that will open up the
hosts file as admin in a single click?

[toc] | [prev] | [next] | [standalone]


#47561

From"Mayayana" <mayayana@invalid.nospam>
Date2017-07-11 09:43 -0400
Message-ID<ok2kei$4d1$1@dont-email.me>
In reply to#47518
"Lionel Muller" <Erhohterlowe@neomailbox.com> wrote

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

A side note that might be of interest to people
who edit HOSTS:

http://mayakron.altervista.org/wikibase/show.php?id=AcrylicHome

  Acrylic DNS proxy. Small, free, DNS proxy server.
In short, it sits between your computer and online
DNS servers, providing customizability. The notable
function is that it has its own HOSTS file. Your DNS
calls go to Acrylic and Acrylic calls a DNS server,
if necessary.
  I keep shortcuts to both HOSTS files on the desktop,
but rarely use windows HOSTS anymore. Acrylic
HOSTS allows wildcards. So you don't need things like:

127.0.0.1 ads.doubleclick.com
127.0.0.1 ad.doubleclick.com
127.0.0.1 ad.213.doubleclick.com

 All that's required is:

127.0.0.1 *.doubleclick.com

  A number of ad servers and trackers tend to create
random subdomains, which are hard to keep up with.
Using Acrylic you only need to block the top-level
domain.

[toc] | [prev] | [next] | [standalone]


#47601

FromLionel Muller <Erhohterlowe@neomailbox.com>
Date2017-07-11 17:36 +0000
Message-ID<ok32a4$1jva$1@gioia.aioe.org>
In reply to#47561
For alt.comp.os.windows-10 Mayayana wrote:


> A side note that might be of interest to people
> who edit HOSTS:
> 
> http://mayakron.altervista.org/wikibase/show.php?id=AcrylicHome

Thank you Mayayana for the Acrylic DNS suggestion which I already knew
about and which is a great way to reduce my hosts file from the 30,000
lines it currently is to probably down to only ten thousand lines or so.

I really should have made the OP more clear because almost all the answers
are off target, which is my fault.

So if I could start again, I'd say this isn't a question which has an
obvious answer since the goal is to get as close to a single-click admin
editing of the hosts file as possible.

Anyone can edit the hosts file in a series of clicks, but it takes an
expert to do it in one click.

That's why I'm asking the experts here for advice.

If the hosts file ended with "txt" it would be trivial.
If the hosts file didn't have to be edited as admin, it would be trivial.

But the fact is that Windows doesn't do anything automatic by default with
a file that has no extension other than to pop up a search for the editor,
which is a waste of steps for a file that I know what I want to edit it in.

Also, it has to be edited as admin.

It was my fault for not being clear that only a Windows expert could
possibly answer the question, as I already tried to do it in a single step:
  Start > Run > hosts <return>

I can get that to easily work if I don't have to edit as admin and if the
hosts file had an extension, so what I'm trying to get is a single click
admin edit of the hosts file sans extension.

We solved a very similar problem with opening up a command window as admin
just a few weeks ago, so I tried the batch file method, but it failed.

What would you modify in this batch file (which opens a command window as
admin) to make it edit the hosts file instead?
===================
@ECHO OFF

REM Open a new shell "Run As Administrator"
REM Based on script by foxidrive on alt.msdos.batch

SETLOCAL ENABLEEXTENSIONS

IF NOT "%~1"=="" goto :START

SET MyFile=%TEMP%\Admin.vbs"
Echo Set UAC = CreateObject("Shell.Application") >"%MyFile%"
Echo UAC.ShellExecute "%~f0", "%cd%", "", "runas", 1 >>"%MyFile%"
Start "" /MIN "%MyFile%"
goto :EOF

:START
Cmd /k "CD /D "%*" & Echo Administrator: & color 4F"\
===================
This didn't work but I really don't know what it's doing.
===================
@ECHO OFF
SET MyFile=C:\Windows\System32\Drivers\etc\hosts
Echo Set UAC = CreateObject("Shell.Application") >"%MyFile%"
Echo UAC.ShellExecute "%~f0", "%cd%", "", "runas", 1 >>"%MyFile%"
Start "" /MIN "notepad.exe %MyFile%"
===================

[toc] | [prev] | [next] | [standalone]


#47684

From"Mayayana" <mayayana@invalid.nospam>
Date2017-07-11 18:40 -0400
Message-ID<ok3jun$jii$1@dont-email.me>
In reply to#47601
"Lionel Muller" <Erhohterlowe@neomailbox.com> 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. ?

[toc] | [prev] | [next] | [standalone]


#47692

FromLionel Muller <Erhohterlowe@neomailbox.com>
Date2017-07-11 23:48 +0000
Message-ID<ok3o3j$hai$4@gioia.aioe.org>
In reply to#47684
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.

[toc] | [prev] | [next] | [standalone]


#47727

FromChar Jackson <none@none.invalid>
Date2017-07-12 00:00 -0500
Message-ID<b3bbmchs9ov2b91sa9mpi0083octkrgn3m@4ax.com>
In reply to#47692
On Tue, 11 Jul 2017 23:48:03 +0000 (UTC), Lionel Muller
<Erhohterlowe@neomailbox.com> 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. :-)

[toc] | [prev] | [next] | [standalone]


#47752

FromLionel Muller <Erhohterlowe@neomailbox.com>
Date2017-07-12 11:49 +0000
Message-ID<ok52br$4ol$1@gioia.aioe.org>
In reply to#47727
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

[toc] | [prev] | [next] | [standalone]


#47747

From"Auric__" <not.my.real@email.address>
Date2017-07-12 07:32 +0000
Message-ID<XnsA7B062F1ABD5auricauricauricauric@213.239.209.88>
In reply to#47684
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.

[toc] | [prev] | [next] | [standalone]


#47766

From"Mayayana" <mayayana@invalid.nospam>
Date2017-07-12 08:14 -0400
Message-ID<ok53jf$cj6$1@dont-email.me>
In reply to#47747
** Posted in VBS group from a HOSTS file
discussion in Win10 group. **

"Auric__" <not.my.real@email.address> 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. 

[toc] | [prev] | [next] | [standalone]


Page 1 of 4  [1] 2 3 4  Next page →

Back to top | Article view | alt.comp.os.windows-10


csiph-web