How do you add an IP address/hostname pair to the host file in Windows 7?

109,549

To edit the hosts file

C:\Windows\system32\drivers\etc\hosts

in Windows 7, you need to run the editor (eg. notepad) as administrator, which you do by locating it through the Start menu and then right clicking on the editor's icon, then manually open and edit the hosts file.

Share:
109,549

Related videos on Youtube

Jay R.
Author by

Jay R.

Updated on September 17, 2022

Comments

  • Jay R.
    Jay R. almost 2 years

    Our network IT people hate us, so our IP addresses are not entered into the DNS lookup automatically if we run a non-Windows OS. How do I get my Windows 7 machine to find the non-Windows OS machine by using the hostname?

    In Windows XP, I added the hostname and IP address of the linux box to the C:\WINDOWS\system32\drivers\etc\hosts file. Under 64-bit Windows 7, how do I do that? I can't just edit the host file by opening it with Notepad from the file explorer window.

  • Jay R.
    Jay R. almost 15 years
    I used TextPad as Admin and the etc directory wouldn't show up in the file browser list. Works in notepad though.
  • Jay R.
    Jay R. almost 15 years
    You definitely have to be administrator.
  • AP257
    AP257 about 10 years
    If the above does not work, ie access denied when trying to save host, you can copy it to your desktop then edit it and than copy/replace it in ../drivers/etc. Admin priviliges are still necessary
  • Seth Painter
    Seth Painter about 10 years
    I think the etc directory is a system protected, or hidden folder, so you may or may not see it based on your settings. If you browse directly to the folder by path though, you should be successful.
  • wmorrison365
    wmorrison365 about 8 years
    Similarly, I got to ...\etc but no files visible in Open dialog. Had to manually enter hosts, which opened file with no issues (WordPad).