共用方式為


VariableProvider Class

Definition

This provider is the data accessor for shell variables. It uses the HashtableProvider as the base class to get a hashtable as a data store.

public ref class VariableProvider sealed : Microsoft::PowerShell::Commands::SessionStateProviderBase
public sealed class VariableProvider : Microsoft.PowerShell.Commands.SessionStateProviderBase
[System.Management.Automation.OutputType(new System.Type[] { typeof(System.Management.Automation.PSVariable) }, ProviderCmdlet="Copy-Item")]
[System.Management.Automation.OutputType(new System.Type[] { typeof(System.Management.Automation.PSVariable) }, ProviderCmdlet="Get-Item")]
[System.Management.Automation.OutputType(new System.Type[] { typeof(System.Management.Automation.PSVariable) }, ProviderCmdlet="New-Item")]
[System.Management.Automation.OutputType(new System.Type[] { typeof(System.Management.Automation.PSVariable) }, ProviderCmdlet="Rename-Item")]
[System.Management.Automation.OutputType(new System.Type[] { typeof(System.Management.Automation.PSVariable) }, ProviderCmdlet="Set-Item")]
[System.Management.Automation.Provider.CmdletProvider("Variable", System.Management.Automation.Provider.ProviderCapabilities.ShouldProcess)]
public sealed class VariableProvider : Microsoft.PowerShell.Commands.SessionStateProviderBase
[System.Management.Automation.Provider.CmdletProvider("Variable", System.Management.Automation.Provider.ProviderCapabilities.ShouldProcess)]
[System.Management.Automation.OutputType(typeof(System.Management.Automation.PSVariable), ProviderCmdlet="Set-Item")]
[System.Management.Automation.OutputType(typeof(System.Management.Automation.PSVariable), ProviderCmdlet="Rename-Item")]
[System.Management.Automation.OutputType(typeof(System.Management.Automation.PSVariable), ProviderCmdlet="Copy-Item")]
[System.Management.Automation.OutputType(typeof(System.Management.Automation.PSVariable), ProviderCmdlet="Get-Item")]
[System.Management.Automation.OutputType(typeof(System.Management.Automation.PSVariable), ProviderCmdlet="New-Item")]
public sealed class VariableProvider : Microsoft.PowerShell.Commands.SessionStateProviderBase
type VariableProvider = class
    inherit SessionStateProviderBase
[<System.Management.Automation.OutputType(new System.Type[] { typeof(System.Management.Automation.PSVariable) }, ProviderCmdlet="Copy-Item")>]
[<System.Management.Automation.OutputType(new System.Type[] { typeof(System.Management.Automation.PSVariable) }, ProviderCmdlet="Get-Item")>]
[<System.Management.Automation.OutputType(new System.Type[] { typeof(System.Management.Automation.PSVariable) }, ProviderCmdlet="New-Item")>]
[<System.Management.Automation.OutputType(new System.Type[] { typeof(System.Management.Automation.PSVariable) }, ProviderCmdlet="Rename-Item")>]
[<System.Management.Automation.OutputType(new System.Type[] { typeof(System.Management.Automation.PSVariable) }, ProviderCmdlet="Set-Item")>]
[<System.Management.Automation.Provider.CmdletProvider("Variable", System.Management.Automation.Provider.ProviderCapabilities.ShouldProcess)>]
type VariableProvider = class
    inherit SessionStateProviderBase
[<System.Management.Automation.Provider.CmdletProvider("Variable", System.Management.Automation.Provider.ProviderCapabilities.ShouldProcess)>]
[<System.Management.Automation.OutputType(typeof(System.Management.Automation.PSVariable), ProviderCmdlet="Set-Item")>]
[<System.Management.Automation.OutputType(typeof(System.Management.Automation.PSVariable), ProviderCmdlet="Rename-Item")>]
[<System.Management.Automation.OutputType(typeof(System.Management.Automation.PSVariable), ProviderCmdlet="Copy-Item")>]
[<System.Management.Automation.OutputType(typeof(System.Management.Automation.PSVariable), ProviderCmdlet="Get-Item")>]
[<System.Management.Automation.OutputType(typeof(System.Management.Automation.PSVariable), ProviderCmdlet="New-Item")>]
type VariableProvider = class
    inherit SessionStateProviderBase
Public NotInheritable Class VariableProvider
Inherits SessionStateProviderBase
Inheritance
Attributes

Constructors

VariableProvider()

The constructor for the provider that exposes variables to the user as drives.

Fields

ProviderName

Gets the name of the provider.

Properties

AltItemSeparator

Gets the alternate item separator character for this provider.

(Inherited from CmdletProvider)
Credential

Gets the credentials under which the operation should run.

(Inherited from CmdletProvider)
CurrentPSTransaction

Gets an object that surfaces the current PowerShell transaction. When this object is disposed, PowerShell resets the active transaction.

(Inherited from CmdletProvider)
DynamicParameters

The dynamic parameters object populated with the values as specified by the user.

(Inherited from CmdletProvider)
Exclude

Gets the exclude wildcard patterns which is used to determine which items will be excluded when taking an action.

(Inherited from CmdletProvider)
Filter

Gets the provider specific filter that was supplied by the caller.

(Inherited from CmdletProvider)
Force

Gets the force property.

(Inherited from CmdletProvider)
Host

Gets the host interaction APIs.

(Inherited from CmdletProvider)
Include

Gets the include wildcard patterns which is used to determine which items will be included when taking an action.

(Inherited from CmdletProvider)
InvokeCommand

Gets the instance of the command invocation APIs for the current runspace.

(Inherited from CmdletProvider)
InvokeProvider

Gets the instance of the provider interface APIs for the current runspace.

(Inherited from CmdletProvider)
ItemSeparator

Gets the default item separator character for this provider.

(Inherited from CmdletProvider)
ProviderInfo

The information about the provider that is stored in the runspace on behalf of the provider.

(Inherited from CmdletProvider)
PSDriveInfo

The drive information associated with the context of the current operation.

(Inherited from CmdletProvider)
SessionState

Gets the instance of session state for the current runspace.

(Inherited from CmdletProvider)
Stopping

Indicates whether stop has been requested on this provider.

(Inherited from CmdletProvider)

Methods

ClearContent(String)

Always throws a NotSupportedException.

(Inherited from SessionStateProviderBase)
ClearContentDynamicParameters(String)

Always returns null.

(Inherited from SessionStateProviderBase)
ClearItem(String) (Inherited from SessionStateProviderBase)
ClearItemDynamicParameters(String)

Gives the provider an opportunity to attach additional parameters to the clear-item cmdlet.

(Inherited from ItemCmdletProvider)
ConvertPath(String, String, String, String)

Gets a new provider-specific path and filter (if any) that corresponds to the given path.

(Inherited from ContainerCmdletProvider)
CopyItem(String, String, Boolean)

Copies the specified item.

(Inherited from SessionStateProviderBase)
CopyItemDynamicParameters(String, String, Boolean)

Gives the provider an opportunity to attach additional parameters to the copy-item cmdlet.

(Inherited from ContainerCmdletProvider)
ExpandPath(String)

Expand a provider path that contains wildcards to a list of provider paths that the path represents.Only called for providers that declare the ExpandWildcards capability.

(Inherited from ItemCmdletProvider)
GetChildItems(String, Boolean, UInt32)

Gets the children of the item at the specified path.

(Inherited from ContainerCmdletProvider)
GetChildItems(String, Boolean)

Gets the item(s) at the given path.

(Inherited from SessionStateProviderBase)
GetChildItemsDynamicParameters(String, Boolean)

Gives the provider an opportunity to attach additional parameters to the get-childitem cmdlet.

(Inherited from ContainerCmdletProvider)
GetChildNames(String, ReturnContainers)

Gets the name(s) of the item(s) at the given path.

(Inherited from SessionStateProviderBase)
GetChildNamesDynamicParameters(String)

Gives the provider an opportunity to attach additional parameters to the get-childitem -name cmdlet.

(Inherited from ContainerCmdletProvider)
GetContentReader(String)

Gets an instance of the content reader for this provider for the specified path.

(Inherited from SessionStateProviderBase)
GetContentReaderDynamicParameters(String)

Always returns null.

(Inherited from SessionStateProviderBase)
GetContentWriter(String)

Gets an instance of the content writer for this provider for the specified path.

(Inherited from SessionStateProviderBase)
GetContentWriterDynamicParameters(String)

Always returns null.

(Inherited from SessionStateProviderBase)
GetItem(String)

Gets an item from session state.

(Inherited from SessionStateProviderBase)
GetItemDynamicParameters(String)

Gives the provider an opportunity to attach additional parameters to the get-item cmdlet.

(Inherited from ItemCmdletProvider)
GetResourceString(String, String)

Gets the resource string corresponding to baseName and resourceId from the current assembly. You should override this if you require a different behavior.

(Inherited from CmdletProvider)
HasChildItems(String)

Determines if there are any items.

(Inherited from SessionStateProviderBase)
InitializeDefaultDrives()

Gives the provider the ability to map drives after initialization.

(Inherited from DriveCmdletProvider)
InvokeDefaultAction(String)

Invokes the default action on the specified item.

(Inherited from ItemCmdletProvider)
InvokeDefaultActionDynamicParameters(String)

Gives the provider an opportunity to attach additional parameters to the invoke-item cmdlet.

(Inherited from ItemCmdletProvider)
IsValidPath(String)

Determines if the specified path is syntactically and semantically valid.

(Inherited from SessionStateProviderBase)
ItemExists(String)

Determines if the specified item exists.

(Inherited from SessionStateProviderBase)
ItemExistsDynamicParameters(String)

Gives the provider an opportunity to attach additional parameters to the test-path cmdlet.

(Inherited from ItemCmdletProvider)
NewDrive(PSDriveInfo)

Gives the provider an opportunity to validate the drive that is being added. It also allows the provider to modify parts of the PSDriveInfo object. This may be done for performance or reliability reasons or to provide extra data to all calls using the Drive.

(Inherited from DriveCmdletProvider)
NewDriveDynamicParameters()

Gives the provider an opportunity to attach additional parameters to the New-PSDrive cmdlet.

(Inherited from DriveCmdletProvider)
NewItem(String, String, Object)

Creates a new item if one of the same name doesn't already exist.

(Inherited from SessionStateProviderBase)
NewItemDynamicParameters(String, String, Object)

Gives the provider an opportunity to attach additional parameters to the new-item cmdlet.

(Inherited from ContainerCmdletProvider)
RemoveDrive(PSDriveInfo)

Gives the provider an opportunity to clean up any provider specific data for the drive that is going to be removed.

(Inherited from DriveCmdletProvider)
RemoveItem(String, Boolean)

Removes the item at the specified path.

(Inherited from SessionStateProviderBase)
RemoveItemDynamicParameters(String, Boolean)

Gives the provider an opportunity to attach additional parameters to the remove-item cmdlet.

(Inherited from ContainerCmdletProvider)
RenameItem(String, String)

Copies the specified item.

(Inherited from SessionStateProviderBase)
RenameItemDynamicParameters(String, String)

Gives the provider an opportunity to attach additional parameters to the rename-item cmdlet.

(Inherited from ContainerCmdletProvider)
SetItem(String, Object)

Sets a session state item to a given value.

(Inherited from SessionStateProviderBase)
SetItemDynamicParameters(String, Object)

Gives the provider an opportunity to attach additional parameters to the set-item cmdlet.

(Inherited from ItemCmdletProvider)
ShouldContinue(String, String, Boolean, Boolean) (Inherited from CmdletProvider)
ShouldContinue(String, String) (Inherited from CmdletProvider)
ShouldProcess(String, String, String, ShouldProcessReason) (Inherited from CmdletProvider)
ShouldProcess(String, String, String) (Inherited from CmdletProvider)
ShouldProcess(String, String) (Inherited from CmdletProvider)
ShouldProcess(String) (Inherited from CmdletProvider)
Start(ProviderInfo)

Gives the provider the opportunity to initialize itself.

(Inherited from CmdletProvider)
StartDynamicParameters()

Gets an object that defines the additional parameters for the Start implementation for a provider.

(Inherited from CmdletProvider)
Stop()

Called by session state when the provider is being removed.

(Inherited from CmdletProvider)
StopProcessing() (Inherited from CmdletProvider)
ThrowTerminatingError(ErrorRecord) (Inherited from CmdletProvider)
TransactionAvailable()

Returns true if a transaction is available and active.

(Inherited from CmdletProvider)
WriteDebug(String) (Inherited from CmdletProvider)
WriteError(ErrorRecord) (Inherited from CmdletProvider)
WriteInformation(InformationRecord) (Inherited from CmdletProvider)
WriteInformation(Object, String[]) (Inherited from CmdletProvider)
WriteItemObject(Object, String, Boolean)

Writes an item to the output as a PSObject with extra data attached as notes.

(Inherited from CmdletProvider)
WriteProgress(ProgressRecord) (Inherited from CmdletProvider)
WritePropertyObject(Object, String)

Writes a property object to the output as a PSObject with extra data attached as notes.

(Inherited from CmdletProvider)
WriteSecurityDescriptorObject(ObjectSecurity, String)

Writes a Security Descriptor object to the output as a PSObject with extra data attached as notes.

(Inherited from CmdletProvider)
WriteVerbose(String) (Inherited from CmdletProvider)
WriteWarning(String) (Inherited from CmdletProvider)

Applies to