summaryrefslogtreecommitdiffstats
path: root/chrome/tools/build/win/map_drive.bat
blob: c415d1ee237ac033fc7634ee85f9b37068647c55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
@echo off

set SHARE_NAME=\\chrome-dev\chrome
set DRIVE_LETTER=%1
set PATH=%SystemRoot%;%SystemRoot%\system32

net use %DRIVE_LETTER%
if errorlevel 1 goto DRIVE_NOT_MAPPED

net use %DRIVE_LETTER% | find "%SHARE_NAME%" > nul
if not errorlevel 1 goto DRIVE_ALREADY_MAPPED

:WRONG_DRIVE_MAPPED
echo %DRIVE_LETTER% Drive mapped to wrong share, disconnecting..
net use %DRIVE_LETTER% /DELETE
goto MAPDRIVE

:DRIVE_ALREADY_MAPPED
echo %DRIVE_LETTER% Drive already mapped..
goto END

:DRIVE_NOT_MAPPED
echo %DRIVE_LETTER% Drive not mapped..
goto MAPDRIVE

:MAPDRIVE
echo Mapping %DRIVE_LETTER% to %SHARE_NAME%
net use %DRIVE_LETTER% %SHARE_NAME%

:END