You can connect WebDrive to your server using the command line and also using scripts. These examples assume that WebDrive was installed into the default directory of C:/Program Files/WebDrive. Here are some examples:


1. Connecting to a site that is predefined in WebDrive: 


"C:\Program Files\WebDrive\WebDrive.exe" /s:"MySite"


The /s switch provides the name of the site profile that has already been created and configured in the WebDrive UI.

In this case, it is not necessary to specific the username, password, protocol to be used, URL, or drive letter, because these are all configured in the site profile that has already been created in WebDrive.


2. Creating a connection and then connecting that site using WebDrive: 


"C:\Program Files\WebDrive\WebDrive.exe" /s:"MySite" /pr:1 /url:"https://example.url.com/MySiteFiles" /u:testuser /p:testpassword /d:Z


The /s switch provides the site profile with a name. This is required for WebDrive.

The /pr switch selects the protocol to be used. 1 selects WebDAV. This is required when the site is not predefined in the WebDrive UI.

The /u switch allows entering the username for the connection.

The /p switch allows entering the password associated with the username.

The /d switch assigns the connections to a specific drive letter. This is required for WebDrive.


The full list of switches and options for each switch can be found in the Help File: https://southrivertech.com/support/webdrive/v16/#WebDrive/Advanced/CommandLineParameters.htm%3FTocPath%3DAdvanced%7C_____2


3. If the server you are connecting to supports Active Directory Authentication (usually IIS Servers), you can utilize AD credentials by omitting the username and password switches, or by entering empty strings ("") for each.


4. Connecting, copying files, and then disconnecting a drive. For this example, the drive is mapped to X: 


start /wait /D"C:\Program Files\WebDrive" WebDrive.exe /s:"MySite" 

copy x:\example.txt c:\ 

start /wait /D"C:\Program Files\WebDrive" WebDrive.exe X: /d


Using the start /wait command and switch allows for proper timing to ensure that different operations work properly. /D means that the path is coming next.

The /s switch provides the name of the site profile that has already been created and configured in the WebDrive UI. 

The copy command is used to copy the example.txt file from its location at the root of X: to the root of C:

Again, the start /wait /D sequence is issued before calling WebDrive.exe again. 

The X: selects the X drive (the WebDrive mapped drive in this example) and the /d switch disconnects the mapping.