8

Maybe this is a silly question, but today I was working in my hosts file (C:\windows\system32\drivers\hosts) in notepad++ and would like to use the language formatting.

For example, the first line appears to be a comment

# Copyright (c) 1993-1999 Microsoft Corp.

What language do I choose to view the file?

Toto
  • 89,455
  • 62
  • 89
  • 125
Josiah Ruddell
  • 29,697
  • 8
  • 65
  • 67

2 Answers2

5

The hosts file is not written in any programming language. It's simply plain text in a format easily parseable by certain system and network applications. Besides, anyone can come up with a parser that treats text delimited by # as comment lines.

(And in case you didn't get the hint, choose the option that I highlighted in bold.)

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
  • 3
    *What language do I choose to view the file?* was my question. Plain text does nothing. However as Mak Killbers pointed out perl does format the comments. – Josiah Ruddell Jan 05 '11 at 20:58
  • 1
    Well, I would personally go for plain text, because I'd rather not see hostnames and IP addresses get colored all wrong just because they got tokenized during syntax highlighting along with comments. – BoltClock Jan 05 '11 at 21:07
  • 9
    Note: these days it's under **Normal text** rather than **Plain text**. – Mark Butler Jul 28 '15 at 15:31
  • It has a defined format, namelly, it can be tokenized. https://en.wikipedia.org/wiki/Hosts_%28file%29 Nncrontab is a good option. – elpezganzo Apr 19 '23 at 17:28
1

try Nncrontab language, it's easy to read if you have to maintain big host files. With comment at the end of the line, the display is better than Perl or ini language.