• How do I get at the hosts file?

    From J. P. Gilliver@21:1/5 to All on Sat Jul 12 05:03:49 2025
    I have a shortcut to

    %windir%\system32\notepad.exe C:\Windows\System32\drivers\etc\hosts

    , 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.
    --
    J. P. Gilliver. UMRA: 1960/<1985 MB++G()AL-IS-Ch++(p)Ar@T+H+Sh0!:`)DNAf

    He's incorrigibly naughty, as only a senior citizen can be.
    - David Hepworth (on Barry Humphries), RT 2020/2/1-7

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Operation Sindoor@21:1/5 to J. P. Gilliver on Sat Jul 12 05:08:04 2025
    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.

    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From J. P. Gilliver@21:1/5 to Operation Sindoor on Sat Jul 12 14:37:20 2025
    XPost: alt.comp.os.windows-11, alt.windows7.general

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







    --
    J. P. Gilliver. UMRA: 1960/<1985 MB++G()AL-IS-Ch++(p)Ar@T+H+Sh0!:`)DNAf

    "Victory does not bring with it a sense of triumph - rather the dull
    numbness of relief..."
    - Cecil Beaton quoted by Anthony Horowitz, RT 2015/1/3-9

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Operation Sindoor@21:1/5 to J. P. Gilliver on Sat Jul 12 19:39:53 2025
    XPost: alt.comp.os.windows-11, alt.windows7.general

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









    You need to do the simplest thing in Windows. From above I surmise that
    you are doing the long winded method and it only complicates the matter.

    In the search box type Notepad.exe. When you get the search result,
    right click on it and choose run as administrator.

    Then do what is shown in this picture:

    <https://i.imgur.com/92EA7P9.png>

    In the picture I have high-lighted All Files and file name I just copied
    and pasted the link previously given.

    hosts file hasn't got an extension and by default Notepad only sees .txt
    file so you need to change this for this exercise.

    All Windows System have hosts file (by default) unless the user or some
    malware has deleted it. It is easy to create one as it is a plain text
    file. Make sure it is saved as "hosts" -- no .txt nor no ".". By dot I
    mean don't save save as "hosts." <== Notice the dot in the file name.
    Don't do it.

    Hope this helps.

    Jai Hind

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dillinger@21:1/5 to J. P. Gilliver on Sat Jul 12 22:06:56 2025
    On Sat, 12 Jul 2025 05:03:49 +0100, J. P. Gilliver wrote:

    I have a shortcut to

    %windir%\system32\notepad.exe C:\Windows\System32\drivers\etc\hosts

    , 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.

    Don't play with notepad, install Microsoft Powertoys, it has a nice noob friendly hosts file editor: https://learn.microsoft.com/en-us/windows/powertoys/hosts-file-editor

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From MikeS@21:1/5 to J. P. Gilliver on Sat Jul 12 22:07:28 2025
    XPost: alt.comp.os.windows-11, alt.windows7.general

    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"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kerr-Mudd, John@21:1/5 to J. P. Gilliver on Sat Jul 12 22:01:13 2025
    XPost: alt.comp.os.windows-11, alt.windows7.general

    On Sat, 12 Jul 2025 14:37:20 +0100
    "J. P. Gilliver" <G6JPG@255soft.uk> 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).>




    C:\WINDOWS\system32\write.exe c:\windows\system32\drivers\etc\hosts

    works for me on XP
    - as does
    %windir%\system32\write.exe c:\windows\system32\drivers\etc\hosts
    and
    %windir%\system32\write.exe %windir%\system32\drivers\etc\hosts



    - I recommend you drop your trailing '.'

    (notepad under XP won't open my large hosts file)
    --
    Bah, and indeed Humbug.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)