{"id":449,"date":"2024-01-21T09:47:38","date_gmt":"2024-01-21T09:47:38","guid":{"rendered":"https:\/\/xuan.co.uk\/?p=449"},"modified":"2024-01-21T09:48:06","modified_gmt":"2024-01-21T09:48:06","slug":"449","status":"publish","type":"post","link":"https:\/\/xuan.co.uk\/?p=449","title":{"rendered":"Export windows share files"},"content":{"rendered":"<p>Batch file to:<br \/>\nextract mapped windows shares<br \/>\nexclude saving H:\\<br \/>\nproduce an import.bat\u00a0 file to be used to remap them<br \/>\nonly paths with spaces need to be wrapped around quotes &#8220;&#8221; manually.<\/p>\n<p>&nbsp;<\/p>\n<blockquote><p>@echo off<br \/>\nsetlocal enabledelayedexpansion<\/p>\n<p>del import_shares.bat \/q<\/p>\n<p>REM Run net use command and filter lines containing &#8220;\\&#8221;<\/p>\n<p>&nbsp;<\/p>\n<p>for \/f &#8220;tokens=2*&#8221; %%A in (&#8216;net use ^| find &#8220;\\&#8221;&#8216;) do (<\/p>\n<p>:: remove h:\\<br \/>\nif \/i &#8220;%%A&#8221; neq &#8220;H:&#8221; (<\/p>\n<p>REM Remove &#8220;Microsoft Windows Network&#8221; text<br \/>\nset &#8220;sharePath=%%B&#8221;<br \/>\nset &#8220;sharePath=!sharePath:Microsoft Windows Network=!&#8221;<\/p>\n<p>REM Trim leading and trailing spaces<br \/>\nfor \/f &#8220;tokens=* delims= &#8221; %%C in (&#8220;!sharePath!&#8221;) do set &#8220;sharePath=%%C&#8221;<\/p>\n<p>REM Display the result<br \/>\necho net use %%A !sharePath!<br \/>\necho net use %%A !sharePath! \/persistent:yes &gt;&gt; import_shares.bat<br \/>\n)<\/p>\n<p>)<\/p>\n<p>endlocal<\/p>\n<p>TIMEOUT \/T 10<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Batch file to: extract mapped windows shares exclude saving H:\\ produce an import.bat\u00a0 file to be used to remap them only paths with spaces need to be wrapped around quotes &#8220;&#8221; manually. &nbsp; @echo off setlocal enabledelayedexpansion del import_shares.bat \/q REM Run net use command and filter lines containing &#8220;\\&#8221; <a class=\"more-link\" href=\"https:\/\/xuan.co.uk\/?p=449\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[87,86,65],"class_list":["post-449","post","type-post","status-publish","format-standard","hentry","category-tech-tips","tag-batch-file","tag-msdos","tag-tech-tips"],"_links":{"self":[{"href":"https:\/\/xuan.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/449","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xuan.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xuan.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xuan.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xuan.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=449"}],"version-history":[{"count":2,"href":"https:\/\/xuan.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/449\/revisions"}],"predecessor-version":[{"id":451,"href":"https:\/\/xuan.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/449\/revisions\/451"}],"wp:attachment":[{"href":"https:\/\/xuan.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=449"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xuan.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=449"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xuan.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=449"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}