{"id":33,"date":"2014-07-31T01:38:10","date_gmt":"2014-07-30T23:38:10","guid":{"rendered":"http:\/\/itso.dk\/?p=33"},"modified":"2014-07-31T01:38:19","modified_gmt":"2014-07-30T23:38:19","slug":"quickly-set-or-change-dns-via-bat-script","status":"publish","type":"post","link":"https:\/\/blog.itso.dk\/?p=33","title":{"rendered":"Quickly set or change DNS via a bat-script"},"content":{"rendered":"<p>When\u00a0running Windows and you want a quick way to change DNS server, you can use a simple script in a *.bat file.<\/p>\n<p>I have several DNS settings that I might want to use, depending if I\u00a0the situation.<\/p>\n<p>Where the &#8220;Ethernet&#8221; is the name of my network card name, change this if necessary.<\/p>\n<p><a href=\"http:\/\/itso.dk\/wp-content\/uploads\/nicname.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-34\" src=\"http:\/\/itso.dk\/wp-content\/uploads\/nicname-300x156.png\" alt=\"nicname\" width=\"300\" height=\"156\" srcset=\"https:\/\/blog.itso.dk\/wp-content\/uploads\/nicname-300x156.png 300w, https:\/\/blog.itso.dk\/wp-content\/uploads\/nicname.png 540w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>When you want to change the DNS setting, just right-click, select run as administrator and you are done.<\/p>\n<p>&nbsp;<\/p>\n<p>Script 1:<\/p>\n<pre style=\"padding-left: 30px;\">lan-dns-dhcp.bat\r\nnetsh interface ipv4 set dns \"Ethernet\" dhcp\r\nipconfig \/flushdns<\/pre>\n<p>&nbsp;<\/p>\n<p>Script 2:<\/p>\n<pre style=\"padding-left: 30px;\">lan.dns-google.bat\r\n netsh interface ipv4 set dns \"Ethernet\" static 8.8.8.8\r\n netsh interface ipv4 add dns \"Ethernet\" 8.8.4.4 index=2\r\n ipconfig \/flushdns<\/pre>\n<p>&nbsp;<\/p>\n<p>Script 3:<\/p>\n<pre style=\"padding-left: 30px;\"> lan-dns-dhcp.bat\r\n netsh interface ipv4 set dns \"Ethernet\" static 208.122.23.23\r\n netsh interface ipv4 add dns \"Ethernet\" 208.122.23.22 index=2\r\n ipconfig \/flushdns<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When\u00a0running Windows and you want a quick way to change DNS server, you can use a simple script in a *.bat file. I have several DNS settings that I might want to use, depending if I\u00a0the situation. Where the &#8220;Ethernet&#8221; is the name of my network card name, change this if necessary. When you want &#8230;<\/p>\n<p><a href=\"https:\/\/blog.itso.dk\/?p=33\" class=\"more-link\">Continue reading &lsquo;Quickly set or change DNS via a bat-script&rsquo; &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[4,5,3],"class_list":["post-33","post","type-post","status-publish","format-standard","hentry","category-windows-tip","tag-network","tag-script","tag-windows"],"_links":{"self":[{"href":"https:\/\/blog.itso.dk\/index.php?rest_route=\/wp\/v2\/posts\/33","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.itso.dk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.itso.dk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.itso.dk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.itso.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=33"}],"version-history":[{"count":2,"href":"https:\/\/blog.itso.dk\/index.php?rest_route=\/wp\/v2\/posts\/33\/revisions"}],"predecessor-version":[{"id":36,"href":"https:\/\/blog.itso.dk\/index.php?rest_route=\/wp\/v2\/posts\/33\/revisions\/36"}],"wp:attachment":[{"href":"https:\/\/blog.itso.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=33"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.itso.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=33"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.itso.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}