System Functions

DSK( )

Get Current Disk Drive

Format

DSK(disk_id[$][,*][,ERR=stmtref])
 
Where:

*

(asterisk) Returns the name of the volume (rather than the drive).

disk_id[$]

Disk to check. String or numeric expression.

stmtref

Program line number or statement label to which to transfer control.

Returns

Current disk drive identifier.

Note:
This function is primarily for use in Windows. Under UNIX, it is assumed that there is only one disk drive, and this function returns a null ("") string.

Description

The DSK( ) function checks for the existence of a disk drive and returns the current disk drive identifier, volume name. Use either a string or numeric value to specify the drive. If a string is given, the first character indicates the drive (A, B, C, etc.). A null ("") string returns the current disk identifier.

This function returns the operating system's drive prefix ("A:","B:", etc.). If you place an asterisk after disk_id, the function returns the name of the volume mounted on your drive, if any; e.g. DSK("C",*) or DSK(2,*). If the disk drive or volume does not exist, PxPlus returns an Error #17: Invalid file type or contents.

If a numeric value is given, then the value must be a positive integer in a range starting at zero. Use 0 as the value for the first drive, 1 for the second, and so on.

When reporting items based on the universal naming convention, this function returns the UNC-style pathname; i.e. for a current directory of \\server\share\path\, DSK( ) returns \\server\share\.

Example

?dsk("")
C:
?dsk(0)
A: