{"id":18798,"date":"2022-02-13T17:12:47","date_gmt":"2022-02-13T16:12:47","guid":{"rendered":"https:\/\/ekiwi-blog.de\/?p=18798"},"modified":"2022-02-13T18:49:38","modified_gmt":"2022-02-13T17:49:38","slug":"windows-mount-and-unmount-network-drives-with-batch-file","status":"publish","type":"post","link":"https:\/\/ekiwi-blog.de\/en\/18798\/windows-mount-and-unmount-network-drives-with-batch-file\/","title":{"rendered":"Windows: Mount and unmount network drives with batch file"},"content":{"rendered":"<p>Mount and unmount network drives in Windows at the command prompt, here&#8217;s how.<\/p>\n<p><!--more--><\/p>\n<p>Network drives can be connected and disconnected not only via the Explorer, but also via the command prompt. If you are often on different networks, you can quickly connect to network shares for the respective network.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of content<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ekiwi-blog.de\/en\/18798\/windows-mount-and-unmount-network-drives-with-batch-file\/#Video\" >Video<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ekiwi-blog.de\/en\/18798\/windows-mount-and-unmount-network-drives-with-batch-file\/#Mount_share_as_drive\" >Mount share as drive<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ekiwi-blog.de\/en\/18798\/windows-mount-and-unmount-network-drives-with-batch-file\/#Disconnect_network_drive\" >Disconnect network drive<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Video\"><\/span>Video<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/SGADw9HAmWc\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Mount_share_as_drive\"><\/span>Mount share as drive<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>A connection can be made with the following command:<\/p>\n<pre>\r\nnet use Z: \\\\computername\\share password \/user:domain\\username\r\n<\/pre>\n<p>An example:<\/p>\n<pre>\r\nnet use Z: \\\\192.168.178.96\\d taschenbier \/user:192.168.178.96\\userle\r\n<\/pre>\n<p>The share is mounted as drive z:.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ekiwi-blog.de\/wp-content\/uploads\/2022\/02\/netzwerk_1.png\" alt=\"\" width=\"330\" height=\"214\" class=\"aligncenter size-full wp-image-18797\" srcset=\"https:\/\/ekiwi-blog.de\/wp-content\/uploads\/2022\/02\/netzwerk_1.png 330w, https:\/\/ekiwi-blog.de\/wp-content\/uploads\/2022\/02\/netzwerk_1-300x195.png 300w\" sizes=\"auto, (max-width: 330px) 100vw, 330px\" \/><\/p>\n<p>In this case, the connection is included until the next restart. To mount a share permanently, we add the parameter &#8220;\/persistent:yes&#8221;.<\/p>\n<pre>\r\nnet use Z: \\\\192.168.178.96\\d taschenbier \/user:192.168.178.96\\userle \/persistent:yes\r\n<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Disconnect_network_drive\"><\/span>Disconnect network drive<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Network drives can of course be disconnected again. Individual drives can be separated in this way:<\/p>\n<pre>\r\nnet use z: \/delete\r\n<\/pre>\n<p>All network drives can also be disconnected in one go:<\/p>\n<pre>\r\nnet use * \/delete \/y\r\n<\/pre>","protected":false},"excerpt":{"rendered":"<p>Mount and unmount network drives in Windows at the command prompt, here&#8217;s how.<\/p>\n","protected":false},"author":1,"featured_media":14619,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1555],"tags":[1909,1598,1908,1558],"class_list":["post-18798","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-en","tag-batch-en","tag-network","tag-share","tag-windows-en"],"_links":{"self":[{"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/posts\/18798","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/comments?post=18798"}],"version-history":[{"count":0,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/posts\/18798\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/media\/14619"}],"wp:attachment":[{"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/media?parent=18798"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/categories?post=18798"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/tags?post=18798"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}