\etc\hosts and #INCLUDE

Just Jake 0 Reputation points
2024-03-06T09:51:46.5433333+00:00

Windows 11 file C:\Windows\System32\drivers\etc\lmhosts.sam states in part:

# Specifying "#INCLUDE <filename>" will force the RFC NetBIOS (NBT)  
# software to seek the specified <filename> and parse it as if it were  
# local. <filename> is generally a UNC-based name, allowing a  
# centralized lmhosts file to be maintained on a server.  
# It is ALWAYS necessary to provide a mapping for the IP address of the  
# server prior to the #INCLUDE. This mapping must use the #PRE directive.
  1. Is this #include also valid for C:\Windows\System32\drivers\etc\hosts?
  2. If the answer to #1 is "yes," can the @INCLUDE be to a URL?

I'm looking to include a github file in the hosts file and bypass copy | paste because the github file changes regularly.

Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
5,099 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Andreas Baumgarten 104K Reputation points MVP
    2024-03-06T10:01:56.7666667+00:00

    Hi @Just Jake ,

    as far as I know:

    The host file doesn't support the #Include option like the lmhosts file.

    UNC-based names following this naming convention: \\server\share\filename .

    UNC naming is different from the URL naming convention like http:\\server\whatever\file.txt


    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards

    Andreas Baumgarten