다음을 통해 공유


ContainerCmdletProvider.RenameItem(String, String) Method

Definition

Renames the item at the specified path to the new name provided.

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

Parameters

path
String

The path to the item to rename.

newName
String

The name to which the item should be renamed. This name should always be relative to the parent container.

Remarks

Providers override this method to give the user the ability to rename provider objects using the rename-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 allow renaming objects that are generally hidden from the user unless the Force property is set to true. For instance, the FileSystem provider should not allow renaming of a hidden or system file unless the Force property is set to true.

This method is intended for the modification of the item's name only and not for Move operations. An error should be written to WriteError(ErrorRecord) if the newName parameter contains path separators or would cause the item to change its parent location.

The default implementation of this method throws an PSNotSupportedException.

Applies to