7

I routinely need to add / remove / update hosts on a Windows 7 machine to add links to staging / test servers.

On Mac I can use ghosts with the syntax

ghost add staging-server.local 67.207.136.164

Is there a similar command I can use on Windows to achieve the same functionality?

2 Answers 2

9

There are two (well, three really) ways you can do it.

GUI (using notepad, or whatever editor)

Right click on your favourite editor, ensure you Run as administrator (escalate them privileges), goto c:\windows\system32\drivers\etc\HOSTS and then add, edit to your heart's content.

Running without privileges will get you an Access Denied error when you try to save, which is thanks to some Windows security they put up some time ago.

cmd (surprisingly, it has a use sometimes)

Type cmd into your startbar, right click and Run as Administrator, then you can just type echo ipaddress site.com >> c:\windows\system32\drivers\etc\HOSTS

Alternate GUI (What I would advocate)

Hostsman is a nice little program which gives you a GUI you can manage your HOSTS on. I don't know about any other programs, but this seems to work perfectly find for what is needed.

0
4

As mentioned, the the file you need to edit must be edited as Administrator, and the path is c:\windows\system32\drivers\etc\hosts. It can be edited with Notepad or vim or whatever you prefer.

Hosts File Editor is a nice open source and free GUI for managing the hosts file.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .