{"id":1527,"date":"2025-04-05T20:08:23","date_gmt":"2025-04-05T20:08:23","guid":{"rendered":"https:\/\/radzishevsky.info\/blog\/?p=1527"},"modified":"2025-04-05T20:08:23","modified_gmt":"2025-04-05T20:08:23","slug":"automating-network-drives-a-scripted-fix-for-windows-explorer-hang-ups","status":"publish","type":"post","link":"https:\/\/radzishevsky.com\/blog\/automating-network-drives-a-scripted-fix-for-windows-explorer-hang-ups\/","title":{"rendered":"Automating Network Drives: A Scripted Fix for Windows Explorer Hang-ups"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">To seamlessly access the office server, I\u2019ve mapped several network drives on my Windows laptop. While this setup works perfectly in the office, things get a bit tricky when I work from home \u2014 the Windows File Explorer sometimes hangs while trying to access unavailable drives. This has been a known Windows issue for at least a decade, if not longer. Tired of the hassle, I decided to implement a solution.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The fix was both simple and effective, consisting of two key steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create a script that automatically maps drives when they\u2019re accessible and disconnects them when they aren\u2019t.<\/li>\n\n\n\n<li>Configure the script to run at every Windows log-on or unlock.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Below is a straightforward DOS batch script to accomplish this task:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@echo off\nSET ip=192.168.0.99\nSET login=username\nSET pass=somepassword\n\nping -n 1 %ip% | find \"TTL=\" >nul 2>&amp;1\nECHO %errorlevel%\nif %errorlevel%==0 (\n    % Map network path as drive X\n    net use X: \\%ip%\\some_path \/user:%login% %pass% >nul 2>&amp;1\n) else (\n    % Unmap the network path\n    net use X: \/delete \/yes >nul 2>&amp;1\n)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Save this batch file somewhere. Now, you need to add it to the Windows Task Scheduler as a task on each system unlock or log-on:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"779\" src=\"https:\/\/radzishevsky.info\/blog\/wp-content\/uploads\/2025\/04\/image-1024x779.png\" alt=\"\" class=\"wp-image-1528\" style=\"width:609px;height:auto\" srcset=\"https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-1024x779.png 1024w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-300x228.png 300w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-768x584.png 768w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-500x380.png 500w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-150x114.png 150w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-1200x913.png 1200w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-400x304.png 400w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-800x609.png 800w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-200x152.png 200w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image.png 1410w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"774\" src=\"https:\/\/radzishevsky.info\/blog\/wp-content\/uploads\/2025\/04\/image-1-1024x774.png\" alt=\"\" class=\"wp-image-1529\" style=\"width:611px;height:auto\" srcset=\"https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-1-1024x774.png 1024w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-1-300x227.png 300w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-1-768x581.png 768w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-1-500x378.png 500w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-1-150x113.png 150w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-1-1200x907.png 1200w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-1-400x302.png 400w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-1-800x605.png 800w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-1-200x151.png 200w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-1.png 1410w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"465\" src=\"https:\/\/radzishevsky.info\/blog\/wp-content\/uploads\/2025\/04\/image-2-1024x465.png\" alt=\"\" class=\"wp-image-1530\" srcset=\"https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-2-1024x465.png 1024w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-2-300x136.png 300w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-2-768x349.png 768w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-2-1536x698.png 1536w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-2-2048x930.png 2048w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-2-500x227.png 500w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-2-150x68.png 150w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-2-1200x545.png 1200w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-2-400x182.png 400w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-2-800x363.png 800w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-2-200x91.png 200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Arguments:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>-WindowStyle Hidden -command \"Start-Process cmd.exe -ArgumentList '\/c D:\\WORK\\....\\name.bat' -WindowStyle Hidden\"<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"778\" src=\"https:\/\/radzishevsky.info\/blog\/wp-content\/uploads\/2025\/04\/image-3-1024x778.png\" alt=\"\" class=\"wp-image-1531\" style=\"width:684px;height:auto\" srcset=\"https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-3-1024x778.png 1024w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-3-300x228.png 300w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-3-768x583.png 768w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-3-500x380.png 500w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-3-150x114.png 150w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-3-1200x911.png 1200w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-3-400x304.png 400w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-3-800x608.png 800w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-3-200x152.png 200w, https:\/\/radzishevsky.com\/blog\/wp-content\/uploads\/2025\/04\/image-3.png 1410w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If you did everything correctly, now your File Explorer will never hang up on scanning network drives.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To seamlessly access the office server, I\u2019ve mapped several network drives on my Windows laptop. While this setup works perfectly in the office, things get a bit tricky when I work from home \u2014 the Windows File Explorer sometimes hangs while trying to access unavailable drives. This has been a known Windows issue for at&#8230; <a class=\"more-link\" href=\"https:\/\/radzishevsky.com\/blog\/automating-network-drives-a-scripted-fix-for-windows-explorer-hang-ups\/\">Continue reading <span class=\"meta-nav\">&#8594;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[145,127],"tags":[],"class_list":["post-1527","post","type-post","status-publish","format-standard","hentry","category-tech_hacks","category-technology"],"_links":{"self":[{"href":"https:\/\/radzishevsky.com\/blog\/wp-json\/wp\/v2\/posts\/1527","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/radzishevsky.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/radzishevsky.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/radzishevsky.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/radzishevsky.com\/blog\/wp-json\/wp\/v2\/comments?post=1527"}],"version-history":[{"count":1,"href":"https:\/\/radzishevsky.com\/blog\/wp-json\/wp\/v2\/posts\/1527\/revisions"}],"predecessor-version":[{"id":1532,"href":"https:\/\/radzishevsky.com\/blog\/wp-json\/wp\/v2\/posts\/1527\/revisions\/1532"}],"wp:attachment":[{"href":"https:\/\/radzishevsky.com\/blog\/wp-json\/wp\/v2\/media?parent=1527"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/radzishevsky.com\/blog\/wp-json\/wp\/v2\/categories?post=1527"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/radzishevsky.com\/blog\/wp-json\/wp\/v2\/tags?post=1527"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}