-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnet_use_drive_a.bat
60 lines (40 loc) · 1.13 KB
/
net_use_drive_a.bat
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
@echo off
cls
color 0A
setlocal enableextensions enabledelayedexpansion
::--------------------------------------------------------
::
::--------------------------------------------------------
net use a: /delete
set /a I=1
:pingtarget
:: Loop until sd2dav.1und1.de is available.
echo Debug: passing the PingTarget( sd2dav.1und1.de ) %I% times
echo.
ping sd2dav.1und1.de >nul
set /a RC=%ERRORLEVEL%
if %RC% EQU 0 goto netuse
if %RC% GTR 0 color 0C
echo Errorlevel: %ERRORLEVEL%
set /a I=%I%+1
:: Wait 10 seconds before the next try.
ping /n 10 localhost >nul
cls
goto pingtarget
:netuse
color
echo NetUse( A: , PERSISTENT:NO , sd2dav.1und1.de , user , password )
echo.
net use A: /PERSISTENT:NO \\sd2dav.1und1.de@SSL\DavWWWRoot /USER:[email protected] "Secure Password"
set /a RC=%ERRORLEVEL%
:: https://ss64.com/nt/robocopy-exit.html
:: if %RC% EQU 0 goto end
:: if %RC% GTR 0 color 0C & pause
if %RC% GTR 0 (color 0C & echo Errorlevel: %ERRORLEVEL% & goto :pingtarget) else (goto end)
echo Errorlevel: %ERRORLEVEL%
pause
:end
echo
ping /n 10 localhost >nul
color
goto :eof