{"id":1991,"date":"2014-02-28T12:09:34","date_gmt":"2014-02-28T12:09:34","guid":{"rendered":"http:\/\/mccltd.net\/blog\/?p=1991"},"modified":"2014-02-28T12:10:52","modified_gmt":"2014-02-28T12:10:52","slug":"windows-batch-file-to-append-entry-to-hosts-file-on-local-or-remote","status":"publish","type":"post","link":"http:\/\/darenmatthews.com\/blog\/?p=1991","title":{"rendered":"Batch File to append entry to hosts file on local or remote PC"},"content":{"rendered":"<p>These are two small Microsoft Windows batch files which will enable administrators to append entry to hosts file on local or remote PC:<\/p>\n<p><strong>\u00a0First determine the computer name:<\/strong><\/p>\n<p>C:\\Users\\dmatthews\\Desktop&gt;hostname<br \/>\nL00151267<!--more--><\/p>\n<p><strong>Execute this batch file:<\/strong><\/p>\n<p>@echo off<br \/>\nSET Compname=%COMPUTERNAME%<br \/>\nSET filename=\\\\%Compname%\\C$\\WINDOWS\\system32\\drivers\\etc\\hosts<br \/>\necho. &gt;&gt; %filename%<br \/>\necho 172.23.191.65 autodiscover.dstsystems.com &gt;&gt; %filename%<br \/>\ntype \\\\%Compname%\\C$\\WINDOWS\\system32\\drivers\\etc\\hosts<\/p>\n<p><strong>This version can be located on a remote share and executed over the network by the end-user:<\/strong><\/p>\n<p>C:\\Users\\dmatthews\\Desktop&gt;type hostchg.bat<br \/>\n@echo off<br \/>\necho Enter Computer name:<br \/>\necho.<br \/>\nSET \/P Compname=[WSID:]<br \/>\nSET filename=\\\\%Compname%\\C$\\WINDOWS\\system32\\drivers\\etc\\hosts<br \/>\necho. &gt;&gt; %filename%<br \/>\necho 127.0.0.1 bbc.co.uk &gt;&gt; %filename%<br \/>\ntype \\\\%Compname%\\C$\\WINDOWS\\system32\\drivers\\etc\\hosts<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>These are two small Microsoft Windows batch files which will enable administrators to append entry to hosts file on local or remote PC: \u00a0First determine the computer name: C:\\Users\\dmatthews\\Desktop&gt;hostname L00151267<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10],"tags":[],"_links":{"self":[{"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1991"}],"collection":[{"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1991"}],"version-history":[{"count":3,"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1991\/revisions"}],"predecessor-version":[{"id":1994,"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1991\/revisions\/1994"}],"wp:attachment":[{"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1991"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1991"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1991"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}