Command line: Map network drive
        Posted  
        
            by Seb Nilsson
        on Server Fault
        
        See other posts from Server Fault
        
            or by Seb Nilsson
        
        
        
        Published on 2009-05-28T08:49:29Z
        Indexed on 
            2010/05/21
            20:41 UTC
        
        
        Read the original article
        Hit count: 357
        
Windows
|command-line
How do I write a command line in a .bat or .cmd that maps a network drive? I want the script to first check if the drive-letter is mapped, and if it is delete it and then map the drive.
I only have the mapping-command right now. Please help me fill in the blanks:
REM Check if drive exists, if it does, delete it
@echo off
net use q: /persistent:yes \\localhost\C$\MyFolder
pause
Are there any of the parameters wrong? Any that should be added?
© Server Fault or respective owner