Network drives

[VDS7] DialogScript can mount network shares (SMB/CIFS) directly, without shelling out to net use through RUN. On Windows the mount uses the system mpr.dll, so no extra DLL is shipped. (A Linux backend is planned; the verb exists on every platform and returns a clear error where the backend is not yet wired.)

There are two ways to mount: the portable handle form (recommended) and the legacy fixed-letter form.

%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
  • @NEW(drive,<network path>[,<login>,<password>]) mounts the share and returns an access prefix: on Windows a free drive letter chosen automatically (such as Z:), on Linux a mount point. @ok() is 1 on success (otherwise the result is empty). Use the returned value directly in your paths, as %D above.
  • DRIVE unmount,%D releases it (alias: drive close,%D).

This form is the portable one — it picks a free letter for you and is designed to work on Linux too once that backend lands.

Mounting on a specific letter (Windows only)

drive mount,M:,\\server\share,backup_user,secret
file copy,M:\report.txt,c:\local\
drive unmount,M:

DRIVE mount,<letter>,<network path>[,<login>,<password>] mounts on the letter you give. Unlike @new(drive,...), you are responsible for choosing a free letter. This is a Windows-only convenience.

Notes

  • The login and password are optional; if omitted, the current session's credentials are used. For a password that contains a comma, use @chr(44) or wrap the value in quotes (the general DialogScript rule for commas).
  • The mount is not persistent — it disappears when the session ends, like net use without /persistent.
  • @DRIVE(error) returns the message from the last drive operation.

See also