set hosts=c:\windows\system32\drivers\etc\hosts set hoststmp=c:\windows\system32\drivers\etc\hosts.tmp copy %hosts% %hoststmp% notepad %hoststmp% copy %hoststmp% %hosts% pause # # Powershell script for adding/removing/showing entries to the hosts file. # # Known limitations: # - does not handle entries with comments afterwards ("<ip> <host> # comment") # $file = "C:\Windows\System32\drivers\etc\ho