This question already has an answer here:
I have a network drive already mapped. But I want to create a batch file that starts after the startup is complete and reconnect to the mapped network drives.
So far I have seen commands
net use Z: \\myserver\folder_name
But I think it maps a network drive. However I have already created a mapped network drive before. I want to connect to it.
Why I am not using reconnect at logon: I have to connect to a VPN manually, only after that will I be able to connect to the mapped network drive manually. Hence I am writing a batch file which connects to the mapped network drive, among other things like starting a few essential programs.
Windows 7 Enterprise
In the link mentioned above "Can a mapped network drive be reconnected from the command line?" I see a somewhat working solution by "Claus Melander". However the part where I am supposed to assign a title to the opened explorer window does not work. Because the opened window does not have the title I have specified.
REM Reconnect to mapped network drives REM Y drive REM Opens an Explorer window looking at Y: forcing a reconnect start "Y_DRIVE" /MIN explorer Y:\ REM Wait for 5 seconds to allow it to reconnect, Ignore key presses and wait specified time during this time. TIMEOUT /T 5 /NOBREAK Taskkill /fi "windowtitle eq Y_DRIVE"
However, If I jump to a sub folder of the mapped drive, the statement to kill the app by filtering based on window title seems to work.
Looking for more elegant solution ath this point.