To seamlessly access the office server, I’ve 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 — 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.
The fix was both simple and effective, consisting of two key steps:
- Create a script that automatically maps drives when they’re accessible and disconnects them when they aren’t.
- Configure the script to run at every Windows log-on or unlock.
Below is a straightforward DOS batch script to accomplish this task:
@echo off
SET ip=192.168.0.99
SET login=username
SET pass=somepassword
ping -n 1 %ip% | find "TTL=" nul 2&1
ECHO %errorlevel%
if %errorlevel%==0 (
% Map network path as drive X
net use X: \%ip%\some_path /user:%login% %pass% nul 2&1
) else (
% Unmap the network path
net use X: /delete /yes nul 2&1
)
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:



Arguments:
-WindowStyle Hidden -command "Start-Process cmd.exe -ArgumentList '/c D:\WORK\....\name.bat' -WindowStyle Hidden"

If you did everything correctly, now your File Explorer will never hang up on scanning network drives.… >>> Click to read the full post...