DRIVE

Windows Linux macOS

[VDS7]

Syntax

DRIVE MOUNT, <letter>, <network path> {, <login>, <password>}

DRIVE UNMOUNT, <letter or handle>

DRIVE CLOSE, <handle>

Description

This command mounts and unmounts network shares (see Network drives). On Windows it uses the system mpr.dll (no extra DLL); a Linux backend is planned.

The portable way to mount is the @NEW(drive,<network path>[,<login>,<password>]) function, which chooses a free drive letter (or mount point) for you and returns it. This command provides the unmount, and a Windows-only fixed-letter mount:

DRIVE MOUNT, <letter>, <network path> {, <login>, <password>} Windows only. Mounts the share on the drive letter you specify — you must ensure it is free. Login and password are optional (the session's credentials are used otherwise).
DRIVE UNMOUNT, <letter or handle> Unmounts a drive, given either a letter (M:) or the handle returned by @NEW(drive,...).
DRIVE CLOSE, <handle> Alias of UNMOUNT, for symmetry with the @new/close handle model.

The mount is not persistent: it is released when the session ends.

OK

OK is false if the mount or unmount fails; @DRIVE(error) then gives the reason (for example a Windows error code, or — on a platform whose backend is not yet wired — a clear "not yet available" message).

Example

REM portable: let @new pick the letter
%D = @new(drive,\\server\backups,backup_user,secret)
if @ok()
  file copy,c:\data\base.db,%D\nightly\
  drive unmount,%D
else
  warn @drive(error)
end

See also