Szerkesztés

Megosztás a következőn keresztül:


FileSystem.ChDrive Method

Definition

Changes the current drive.

Overloads

ChDrive(Char)

Changes the current drive.

ChDrive(String)

Changes the current drive.

ChDrive(Char)

Source:
FileSystem.vb
Source:
FileSystem.vb
Source:
FileSystem.vb

Changes the current drive.

public:
 static void ChDrive(char Drive);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static void ChDrive (char Drive);
public static void ChDrive (char Drive);
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member ChDrive : char -> unit
static member ChDrive : char -> unit
Public Sub ChDrive (Drive As Char)

Parameters

Drive
Char

Required. String expression that specifies an existing drive. If you supply a zero-length string (""), the current drive does not change. If the Drive argument is a multiple-character string, ChDrive uses only the first letter.

Attributes

Exceptions

Invalid drive is specified, or drive is unavailable.

Examples

This example uses the ChDrive function to change the current drive. The function throws an exception if the drive does not exist.

ChDrive("D")   ' Make "D" the current drive.

Remarks

The ChDrive function requires unmanaged-code permission, which may affect its execution in partial-trust situations. For more information, see SecurityPermission and Code Access Permissions.

See also

Applies to

ChDrive(String)

Source:
FileSystem.vb
Source:
FileSystem.vb
Source:
FileSystem.vb

Changes the current drive.

public:
 static void ChDrive(System::String ^ Drive);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static void ChDrive (string? Drive);
public static void ChDrive (string Drive);
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member ChDrive : string -> unit
static member ChDrive : string -> unit
Public Sub ChDrive (Drive As String)

Parameters

Drive
String

Required. String expression that specifies an existing drive. If you supply a zero-length string (""), the current drive does not change. If the Drive argument is a multiple-character string, ChDrive uses only the first letter.

Attributes

Exceptions

Invalid drive is specified, or drive is unavailable.

Examples

This example uses the ChDrive function to change the current drive. The function throws an exception if the drive does not exist.

ChDrive("D")   ' Make "D" the current drive.

Remarks

The ChDrive function requires unmanaged-code permission, which may affect its execution in partial-trust situations. For more information, see SecurityPermission and Code Access Permissions.

See also

Applies to