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
  #1  
Old July 11th 17, 07:56 AM posted to alt.comp.os.windows-10,alt.windows7.general
Lionel Muller
external usenet poster
 
Posts: 119
Default What is the easiest way to edit the hosts file on Windows as admin?

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?
Ads
  #2  
Old July 11th 17, 08:07 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,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\host s"
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?
  #3  
Old July 11th 17, 08:33 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?

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.
  #4  
Old July 11th 17, 08:44 AM posted to alt.comp.os.windows-10
Lucifer Morningstar[_2_]
external usenet poster
 
Posts: 368
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?


Notebook.

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


Notebook.
  #5  
Old July 11th 17, 10:23 AM posted to alt.comp.os.windows-10
Zeezicht
external usenet poster
 
Posts: 6
Default What is the easiest way to edit the hosts file on Windows as admin?

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
  #6  
Old July 11th 17, 12:49 PM posted to alt.comp.os.windows-10
s|b
external usenet poster
 
Posts: 1,496
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?


What's wrong with opening Explorer, go to directory

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

open HOSTS with Notepad, edit, save, done?

--
s|b
  #7  
Old July 11th 17, 02:15 PM posted to alt.comp.os.windows-10
slate_leeper
external usenet poster
 
Posts: 245
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?


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....ignid=XR014887

Gun control is like trying to reduce drunk driving by making it tougher for sober people to own cars.
  #8  
Old July 11th 17, 02:43 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

| 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/wikib...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.


  #9  
Old July 11th 17, 03:37 PM posted to alt.comp.os.windows-10
Big Al[_7_]
external usenet poster
 
Posts: 177
Default What is the easiest way to edit the hosts file on Windows asadmin?

On 07/11/2017 02:56 AM, 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?

As much as it takes a few minutes, maybe just one, to do what you
outline in making a notepad shortcut as admin to edit the file, it's
super fast to do once you finish.
Any one time setup that isn't hard to make a one click solution seems
great to me.
  #10  
Old July 11th 17, 04:33 PM posted to alt.comp.os.windows-10
Mike Tomlinson
external usenet poster
 
Posts: 654
Default What is the easiest way to edit the hosts file on Windows as admin?

En el artículo ,
slate_leeper 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
  #11  
Old July 11th 17, 05:29 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 11/07/2017 07:56, Lionel Muller wrote:
What is the quickest way to edit the hosts file on Windows as admin?



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



You won't know or understand it because it's rocket science. People
have tried it in the past but failed because they were all like you;
For simple things, you are always looking for difficult ways of doing
them!!.

I take it you are a German Jew? Lionel is a jewish name and Muller is
German.,





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

  #12  
Old July 11th 17, 06:19 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 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?
  #13  
Old July 11th 17, 06:19 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 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.
  #14  
Old July 11th 17, 06:19 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 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.
  #15  
Old July 11th 17, 06:19 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 Big Al wrote:


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

As much as it takes a few minutes, maybe just one, to do what you
outline in making a notepad shortcut as admin to edit the file, it's
super fast to do once you finish.
Any one time setup that isn't hard to make a one click solution seems
great to me.


I apologize for not making it clear that this is a question only Windows
experts can answer.

The goal is one-click admin editing of the Windows hosts file.

I also apologize that I didn't make it clear that the *setup* is not what
I'm trying to improve, because, as you say, setup is a one-time gig.

Since the HOSTS file has to be edited as administrator, I'm trying to
modify the four methods we came up with for opening a command window as
admin in the shortest steps possible.

To that end, the only one of the four methods which worked so far was the
shortcut method, making the target of the shortcut
Target =
C:\Windows\System32\cmd.exe /K "notepad C:\Windows\System32\Drivers\etc\hosts"
[x]

Efficiency is everything when we propose a general method for anyone to
edit the hosts file in the fewest steps possible, so, what we need to fix
in that method is to close the extraneous admin window that also pops up.

I tried just making the target just the path to the HOSTS file, but because
the HOSTS file doesn't have an extension, Windows 10 is too stupid to set a
default editor for files that don't have extensions, so this idea failed.
Target = C:\Windows\System32\Drivers\etc\hosts

I also tried the logical step of making the Target the command:
Target = "notepad C:\Windows\System32\Drivers\etc\hosts"
But that didn't work either.

So what do we need to modify to open the HOSTS file as admin with a link
without opening up an extraneous command window that serves no 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 01:54 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.