1@echo off
2
3set SHARE_NAME=\\chrome-dev\chrome
4set DRIVE_LETTER=%1
5set PATH=%SystemRoot%;%SystemRoot%\system32
6
7net use %DRIVE_LETTER%
8if errorlevel 1 goto DRIVE_NOT_MAPPED
9
10net use %DRIVE_LETTER% | find "%SHARE_NAME%" > nul
11if not errorlevel 1 goto DRIVE_ALREADY_MAPPED
12
13:WRONG_DRIVE_MAPPED
14echo %DRIVE_LETTER% Drive mapped to wrong share, disconnecting..
15net use %DRIVE_LETTER% /DELETE
16goto MAPDRIVE
17
18:DRIVE_ALREADY_MAPPED
19echo %DRIVE_LETTER% Drive already mapped..
20goto END
21
22:DRIVE_NOT_MAPPED
23echo %DRIVE_LETTER% Drive not mapped..
24goto MAPDRIVE
25
26:MAPDRIVE
27echo Mapping %DRIVE_LETTER% to %SHARE_NAME%
28net use %DRIVE_LETTER% %SHARE_NAME%
29
30:END