Groups | Search | Server Info | Login | Register


Groups > alt.comp.os.windows-10 > #185760

Re: How do I get at the hosts file?

From MikeS <mikes@is.invalid>
Newsgroups alt.comp.os.windows-10, alt.comp.os.windows-11, alt.windows7.general
Subject Re: How do I get at the hosts file?
Date 2025-07-12 22:07 +0100
Message-ID <104uiqg$25ovk$1@solani.org> (permalink)
References <104smr5$1h6g5$2@dont-email.me> <104sqv8$2pb5s$1@paganini.bofh.team> <104toeh$22tor$2@dont-email.me>

Cross-posted to 3 groups.

Show all headers | View raw


On 12/07/2025 14:37, J. P. Gilliver wrote:
> On 2025/7/12 6:8:4, Operation Sindoor wrote:
>> On 12/07/2025 05:03, J. P. Gilliver wrote:
>>> I have a shortcut to
>>>
>>> , but it won't let me save when I've edited. I've tried "Take Ownership"
>>> on C:\Windows\System32\drivers\etc, which seemed to run, but I still
>>> can't save changes.
> 
> (I don't know what happened above - maybe I forgot to paste in the 
> command line that's in my shortcut!)>
>> To edit and save the hosts file you need to launch Notepad as
>> Administrator. Then you need to visit the hosts file in Notepad by 
>> going to:
>>
>> File >> Open <"C:\Windows\System32\drivers\etc\hosts">
>>
>> Make sure "All Files" is selected in notepad.
>>
>> To launch Notepad as Administrator you need to Right-Click on the
>> Notepad icon and choose rum as Administrator. The list is quite long so
>> pay particular attention to Run as Administrator.
>>
>> The alternative method to edit and save the hosts file is to drag it to
>> the desktop, edit it and save it before dragging again to the correct
>> folder.
>>
>>
> Thanks - noted.>
> The command line in my shortcut is
> 
>    %windir%\system32\notepad.exe "C:\Windows\System32\drivers\etc\hosts."
> 
> I thought, maybe I can do what you suggest by making my _shortcut_ open 
> as administrator. So I ticked that box. Now, when I activate the 
> shortcut, it comes up with the do-you-want-to-allow...-to-make-changes 
> prompt (which Notepad in normal mode doesn't usually), which sounded 
> promising; I say yes, and notepad opens - but then pops up a box saying 
> it can't find hosts.txt, do I want to create it?
> 
> I've experimented with the above line - without quotes, with quotes but 
> no final ., and as above - all seem to open Notepad (with the 
> do-you-want-to-allow, which is good), but thinking it's going to edit 
> hosts.txt, rather than just hosts.
> 
> I suppose I could make a shortcut - with admin. open - to a two-line 
> batch file to edit notes.txt (or any other name, for that matter), and 
> then rename it to hosts (and also copy it to hosts.txt for next time; 
> or, copy hosts.txt to hosts), but I thought I'd ask here first if 
> there's any way to make the simple shortcut work.
> 
> Thought: does Notepad have some switch ... typing
> 
>      notepad /?
> 
> into a command prompt. Notepad opened, with a popup "The filename, 
> directory name, or volume label syntax is incorrect." So I tried
> 
>      help notepad
> 
> , and got
> 
>     This command is not supported by the help utility.  Try "notepad /?".
> 
> ! Tried
> 
>      notepad < "C:\Windows\System32\drivers\etc\hosts."
> 
> (both without and with the quote marks), and got "The system cannot find 
> the file specified." (I wondered if it just meant it couldn't find 
> notepad, but typing that by itself opens it.)
> 
> That batch file is sounding more and more likely, but I'll wait to see 
> if anyone here knows a way of, in a shortcut target line (or at the 
> command prompt), calling notepad with a parameter that has no extension! 
> (It works _with_ one, which doesn't have to be .txt; for example, I just 
> tried
> 
>      %windir%\system32\notepad.exe 
> "C:\Windows\System32\drivers\etc\hosts.org"
> 
> [all one line, of course] and it opened notepad on that file.) I've 
> added the W11 and W7 'groups as this particular wrinkle - how to invoke 
> notepad with an extensionless parameter - might generate knowledge 
> there, though the initial problem wasn't there in 7 (I can't remember 
> the details, but I had a shortcut to the hosts file that worked there).>
>>
>>
>>
>>
>>
> 
> 
This shortcut works for me after setting it to open as administrator by 
ticking the box:
%windir%\system32\notepad.exe /A "C:\Windows\System32\drivers\etc\hosts"

Back to alt.comp.os.windows-10 | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

How do I get at the hosts file? "J. P. Gilliver" <G6JPG@255soft.uk> - 2025-07-12 05:03 +0100
  Re: How do I get at the hosts file? Operation Sindoor <Operation.Sindoor@invalid.invalid> - 2025-07-12 05:08 +0000
    Re: How do I get at the hosts file? "J. P. Gilliver" <G6JPG@255soft.uk> - 2025-07-12 14:37 +0100
      Re: How do I get at the hosts file? Operation Sindoor <Operation.Sindoor@invalid.invalid> - 2025-07-12 19:39 +0000
        Re: How do I get at the hosts file? "J. P. Gilliver" <G6JPG@255soft.uk> - 2025-07-13 13:22 +0100
      Re: How do I get at the hosts file? "Kerr-Mudd, John" <admin@127.0.0.1> - 2025-07-12 22:01 +0100
        Re: How do I get at the hosts file? "J. P. Gilliver" <G6JPG@255soft.uk> - 2025-07-13 13:36 +0100
          Re: How do I get at the hosts file? Andy Burns <usenet@andyburns.uk> - 2025-07-13 13:44 +0100
            W10/11 different notepad (was: Re: How do I get at the hosts file?) "J. P. Gilliver" <G6JPG@255soft.uk> - 2025-07-13 14:22 +0100
              Re: W10/11 different notepad Andy Burns <usenet@andyburns.uk> - 2025-07-13 15:29 +0100
                Re: W10/11 different notepad knuttle <keith_nuttle@yahoo.com> - 2025-07-13 17:34 -0400
              Re: W10/11 different notepad "...winston" <winstonmvp@gmail.com> - 2025-07-13 10:41 -0400
          Re: How do I get at the hosts file? "Kerr-Mudd, John" <admin@127.0.0.1> - 2025-07-14 20:10 +0100
            write and wordpad (was: Re: How do I get at the hosts file?) "J. P. Gilliver" <G6JPG@255soft.uk> - 2025-07-14 22:02 +0100
          Re: How do I get at the hosts file? micky <NONONOmisc07@fmguy.com> - 2025-07-15 14:32 -0400
            Re: How do I get at the hosts file? Paul <nospam@needed.invalid> - 2025-07-15 14:37 -0400
              Re: How do I get at the hosts file? Marion <marion@facts.com> - 2025-07-15 19:09 +0000
                Re: How do I get at the hosts file? Andy Burns <usenet@andyburns.uk> - 2025-07-16 10:13 +0100
                Re: How do I get at the hosts file? Marion <marion@facts.com> - 2025-07-16 20:06 +0000
                Re: How do I get at the hosts file? Zaidy036 <Zaidy036@air.isp.spam> - 2025-07-16 16:36 -0400
                Re: How do I get at the hosts file? Andy Burns <usenet@andyburns.uk> - 2025-07-16 22:14 +0100
                Re: How do I get at the hosts file? Marion <marion@facts.com> - 2025-07-17 01:52 +0000
                Re: How do I get at the hosts file? Marion <marion@facts.com> - 2025-07-19 03:08 +0000
                Re: How do I get at the hosts file? Andy Burns <usenet@andyburns.uk> - 2025-07-20 21:17 +0100
                Re: How do I get at the hosts file? "J. P. Gilliver" <G6JPG@255soft.uk> - 2025-07-20 23:32 +0100
            Re: How do I get at the hosts file? Zaidy036 <Zaidy036@air.isp.spam> - 2025-07-15 22:02 -0400
      Re: How do I get at the hosts file? MikeS <mikes@is.invalid> - 2025-07-12 22:07 +0100
        Re: How do I get at the hosts file? "J. P. Gilliver" <G6JPG@255soft.uk> - 2025-07-13 13:43 +0100
          Re: How do I get at the hosts file? MikeS <mikes@is.invalid> - 2025-07-15 21:47 +0100
            Re: How do I get at the hosts file? "J. P. Gilliver" <G6JPG@255soft.uk> - 2025-07-15 22:58 +0100
              Re: How do I get at the hosts file? MikeS <mikes@is.invalid> - 2025-07-16 08:21 +0100
                Re: How do I get at the hosts file? "J. P. Gilliver" <G6JPG@255soft.uk> - 2025-07-17 01:33 +0100
    Re: How do I get at the hosts file? "s|b" <me@privacy.invalid> - 2025-07-13 14:07 +0200
      Re: How do I get at the hosts file? "J. P. Gilliver" <G6JPG@255soft.uk> - 2025-07-13 13:46 +0100
        Re: How do I get at the hosts file? "s|b" <me@privacy.invalid> - 2025-07-13 14:55 +0200
          Re: How do I get at the hosts file? "J. P. Gilliver" <G6JPG@255soft.uk> - 2025-07-13 14:29 +0100
            Re: How do I get at the hosts file? "s|b" <me@privacy.invalid> - 2025-07-13 17:47 +0200
  Re: How do I get at the hosts file? dillinger <dillinger@invalid.not> - 2025-07-12 22:06 +0200
    Re: How do I get at the hosts file? "J. P. Gilliver" <G6JPG@255soft.uk> - 2025-07-13 14:01 +0100

csiph-web