共用方式為


PSDriveInfo Class

Definition

Defines a drive that exposes a provider path to the user.

public ref class PSDriveInfo : IComparable
public class PSDriveInfo : IComparable
type PSDriveInfo = class
    interface IComparable
Public Class PSDriveInfo
Implements IComparable
Inheritance
PSDriveInfo
Implements

Remarks

A cmdlet provider may want to derive from this class to provide their own public members or to cache information related to the drive. For instance, if a drive is a connection to a remote machine and making that connection is expensive, then the provider may want keep a handle to the connection as a member of their derived PSDriveInfo class and use it when the provider is invoked.

Constructors

PSDriveInfo(PSDriveInfo)

Constructs a new instance of the PSDriveInfo using another PSDriveInfo as a template.

PSDriveInfo(String, ProviderInfo, String, String, PSCredential, Boolean)

Constructs a drive that maps a PowerShell Path in the shell to a Cmdlet Provider.

PSDriveInfo(String, ProviderInfo, String, String, PSCredential, String)

Constructs a drive that maps a PowerShell Path in the shell to a Cmdlet Provider.

PSDriveInfo(String, ProviderInfo, String, String, PSCredential)

Constructs a drive that maps a PowerShell Path in the shell to a Cmdlet Provider.

Properties

Credential

Gets the credential to use with the drive.

CurrentLocation

Gets or sets the current working directory for the drive.

Description

Gets or sets the description for the drive.

DisplayRoot

Gets or sets the UNC path of the drive. This property would be populated only if the created PSDrive is targeting a network drive or else this property would be null.

MaximumSize

When supported by provider this specifies a maximum drive size.

Name

Gets the name of the drive.

Provider

Gets the name of the provider that root path of the drive represents.

Root

Gets the root path of the drive.

VolumeSeparatedByColon

Methods

CompareTo(Object)

Compares this instance to the specified object. The object must be a PSDriveInfo.

CompareTo(PSDriveInfo)

Compares this instance to the specified drive.

Equals(Object)

Compares this instance to the specified object.

Equals(PSDriveInfo)

Compares this instance to the specified object.

GetHashCode()

Gets the hash code for this instance.

ToString()

Gets the name of the drive as a string.

Operators

Equality(PSDriveInfo, PSDriveInfo)

Equality operator for the drive determines if the drives are equal by having the same name.

GreaterThan(PSDriveInfo, PSDriveInfo)

Compares the specified drives to determine if drive1 is greater than drive2.

Inequality(PSDriveInfo, PSDriveInfo)

Inequality operator for the drive determines if the drives are not equal by using the drive name.

LessThan(PSDriveInfo, PSDriveInfo)

Compares the specified drives to determine if drive1 is less than drive2.

Applies to