Windows – Can a mapped network drive be reconnected from the command line

batchcommand linenetwork-shareswindows

On a daily basis I find myself in the Windows command prompt needing to access a network drive that is mapped but disconnected. I have yet to find a command that will reconnect this drive without unmapping and remapping (which leads to a password guessing game, since I don't own these computers). I would also like to be able to script this so every night the drive is reconnected if it has become disconnected somehow.

The fastest solution I currently have is to:

  1. Type "start." to open explorer,
  2. AltD to focus the address bar,
  3. type the drive letter I want and press enter, and wait for it to display the drive contents,
  4. then finally, close explorer and go back to the command prompt.

I know it's a minor inconvenience, but I'm often doing this through a slow VNC or PCAnywhere connection where doing anything through GUI is awful, so I'm just wondering if there's a better solution.

Best Answer

Maybe try pushd \\server\share?

Related Question