ChDrive Statement

Description

Changes the current drive.

Syntax

ChDrive drive

The drive named argument is a string expression that specifies an existing drive. If you supply a zero-length argument (""), the current drive doesn't change. In Microsoft Windows, if the argument drive is a multiple-character string, ChDrive uses only the first letter. On the Macintosh, ChDrive changes the current folder to the root folder of the specifed drive.

See Also

ChDir Statement, CurDir Function, MkDir Statement, RmDir Statement.

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 since its the
' root.
ChDrive "MY DRIVE:MY FOLDER"