\etc\hosts and #INCLUDE

Just Jake 0 Reputation points

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.

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.
4,717 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Andreas Baumgarten 95,181 Reputation points MVP

    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)


    Andreas Baumgarten