ItemCmdletProviderIntrinsics.Rename Method

Definition

Overloads

Rename(String, String)

Renames the item at the given path.

Rename(String, String, Boolean)

Renames the item at the given path.

Rename(String, String)

Renames the item at the given path.

public:
 System::Collections::ObjectModel::Collection<System::Management::Automation::PSObject ^> ^ Rename(System::String ^ path, System::String ^ newName);
public System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> Rename (string path, string newName);
member this.Rename : string * string -> System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject>
Public Function Rename (path As String, newName As String) As Collection(Of PSObject)

Parameters

path
String

The path to the item to rename. It may be a drive or provider-qualified path and may include glob characters.

newName
String

The new name of the item.

Returns

The item(s) that were renamed.

Exceptions

If path or propertyToClear is null.

If the path refers to a provider that could not be found.

If the path refers to a drive that could not be found.

If path does not contain glob characters and could not be found.

If the provider that the path refers to does not support this operation.

If the provider threw an exception.

Applies to

Rename(String, String, Boolean)

Renames the item at the given path.

public:
 System::Collections::ObjectModel::Collection<System::Management::Automation::PSObject ^> ^ Rename(System::String ^ path, System::String ^ newName, bool force);
public System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> Rename (string path, string newName, bool force);
member this.Rename : string * string * bool -> System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject>
Public Function Rename (path As String, newName As String, force As Boolean) As Collection(Of PSObject)

Parameters

path
String

The path to the item to rename. It may be a drive or provider-qualified path and may include glob characters.

newName
String

The new name of the item.

force
Boolean

Passed on to providers to force operations.

Returns

The item(s) that were renamed.

Exceptions

If path or propertyToClear is null.

If the path refers to a provider that could not be found.

If the path refers to a drive that could not be found.

If path does not contain glob characters and could not be found.

If the provider that the path refers to does not support this operation.

If the provider threw an exception.

Applies to