Results 1 to 5 of 5

Thread: need help replacing host file in my program

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2011
    Posts
    57

    need help replacing host file in my program

    ok wot i want to do is replace the host file in windows so basically i want to make a button that says change host file so when click i have a host file in resources so when i click the button i want to to overight the old one with the new one but the C:/windows/system32/drivers/ect then hosts is there i way i can change it tho my program can some one help please
    Last edited by elfenliedtopfan5; Jan 15th, 2012 at 02:03 AM. Reason: title wos wrong

  2. #2
    Hyperactive Member
    Join Date
    Jan 2002
    Location
    UK, Suffolk
    Posts
    319

    Re: need help replacing host file in my program

    Why would you want to overwrite a host file??

    If you need Hostname to IP Address lookup within your program, can you not just have a local text/ini file with the required contents?

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2011
    Posts
    57

    Re: need help replacing host file in my program

    Quote Originally Posted by drawlings View Post
    Why would you want to overwrite a host file??

    If you need Hostname to IP Address lookup within your program, can you not just have a local text/ini file with the required contents?
    there is a reason behind it just wanted to know if its possible to do thats all

  4. #4
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,401

    Re: need help replacing host file in my program

    Might set off some anti virus software.

    vb Code:
    1. IO.File.WriteAllBytes("C:\WINDOWS\system32\drivers\etc\HOSTS", My.Resources.HOSTS)

  5. #5

    Thread Starter
    Member
    Join Date
    Jul 2011
    Posts
    57

    Re: need help replacing host file in my program

    Quote Originally Posted by ident View Post
    Might set off some anti virus software.

    vb Code:
    1. IO.File.WriteAllBytes("C:\WINDOWS\system32\drivers\etc\HOSTS", My.Resources.HOSTS)
    thank you ever so much worked a treat

    also this is totally out the blue i dont so pose you would know the 64 bit directories to program files sorry if thats out the way just thort ill ask

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width