Freigeben über


ContainerCmdletProvider.RemoveItem(String, Boolean) Method

Definition

Removes (deletes) the item at the specified path.

protected:
 virtual void RemoveItem(System::String ^ path, bool recurse);
protected:
 virtual void RemoveItem(Platform::String ^ path, bool recurse);
 virtual void RemoveItem(std::wstring const & path, bool recurse);
protected virtual void RemoveItem (string path, bool recurse);
abstract member RemoveItem : string * bool -> unit
override this.RemoveItem : string * bool -> unit
Protected Overridable Sub RemoveItem (path As String, recurse As Boolean)

Parameters

path
String

The path to the item to remove.

recurse
Boolean

True if all children in a subtree should be removed, false if only a single level of children should be removed. This parameter should only be true for NavigationCmdletProvider and its derived classes.

Remarks

Providers override this method to allow the user the ability to remove provider objects using the remove-item cmdlet.

Providers that declare ProviderCapabilities of ExpandWildcards, Filter, Include, or Exclude should ensure that the path passed meets those requirements by accessing the appropriate property from the base class.

By default overrides of this method should not remove objects that are generally hidden from the user unless the Force property is set to true. For instance, the FileSystem provider should not remove a hidden or system file unless the Force property is set to true.

The provider implementation is responsible for preventing infinite recursion when there are circular links and the like. An appropriate terminating exception should be thrown if this situation occurs.

The default implementation of this method throws an PSNotSupportedException.

Applies to