ChDrive Statement

Description

Changes the current drive.

Syntax

ChDrive drive

The required drive argument is a string expression that specifies an existing drive. If you supply a zero-length string (" "), the current drive doesn't change. If the drive argument is a multiple-character string, ChDrive uses only the first letter.

See Also

ChDir statement, CurDir function, MkDir statement, RmDir statement.

Specifics (Macintosh)

On the Macintosh, ChDrive changes the current folder to the root folder of the specified drive.

Example

This example uses the ChDrive statement to change the current drive.

' In Microsoft Windows:
ChDrive "D"                                ' Make "D" the current drive.

' On the Macintosh:
' Make "MY DRIVE" the current drive.
ChDrive "MY DRIVE:"
' Make "MY DRIVE" the current drive and current folder because
' it's the root.
ChDrive "MY DRIVE:MY FOLDER"