title: Adding an host programmatically (name resolution under Windows)
body: <p>I would like to programmatically add to Windows a name / IP association so that this name can be resolved locally. This does not have to be persisted between reboots.</p>
  
  <p>The only way I now is to add an entry to the "hosts" file, but this feels hacky especially since I would like to automate this.</p>
  
  <p>Is there any way to do this using a command-line tool or a Win32 API? Perhaps by addind an entry to Windows DNS cache or something similar?</p>
  
  <p>Oh, and please state if this solution is Vista-compatible.</p>
  
  <p>Regards.</p>
  
  <p>Edit : Thanks, guy. Sadly, all of your answers indeed involve DNS or other servers. I was looking for a purely local solution which would work on a "standard" Windows installation. Such a thing does not seem to exist, though.</p>