Created
December 10, 2017 22:12
-
-
Save netbootdau/5343641625ed1e9ac093777a3de9f2e2 to your computer and use it in GitHub Desktop.
Batch file for establishing a WebDAV connection and bind it to a drive letter (non-persistent).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
:REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
:REM | |
:REM Batch file for establishing a WebDAV connection and bind it to a drive | |
:REM letter (non-persistent). | |
:REM | |
:REM Please adopt WEBDAV_HOST and WEBDAV_USER to your needs as well as the | |
:REM default password. You also might want to adopt the default drive the | |
:REM WebDAV connection should be bound to. | |
:REM | |
:REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
:REM ~~~~~~~~~~ | |
:REM PARAMETERS | |
:REM ~~~~~~~~~~ | |
set WEBDAV_HOST=http://your.webdav.host/somedrive | |
set WEBDAV_USER=YourUsername | |
:REM Use "*" to let "net use" ask you for the password. You might | |
:REM change this to the real password but mind that this is a security risk. | |
set WEBDAV_PASSWORD=* | |
set DRIVE=X: | |
if exist %DRIVE% ( | |
echo Drive %DRIVE% already in use. Choosing the next free one... | |
set DRIVE=* | |
) | |
:REM ~~~~~~~~~~~~~~~~~~~~ | |
:REM Establish Connection | |
:REM ~~~~~~~~~~~~~~~~~~~~ | |
echo Establishing connection to "%WEBDAV_HOST%" for "%WEBDAV_USER%"... | |
echo. | |
net use "%DRIVE%" "%WEBDAV_HOST%" /User:"%WEBDAV_USER%" "%WEBDAV_PASSWORD%" /persistent:no | |
if not errorlevel 1 ( | |
echo. | |
net use | |
) | |
:END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment