You are currently viewing PowerShell Rename-Item Cmdlet

PowerShell Rename-Item Cmdlet

PowerShell Rename-Item Cmdlet

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In the last blog post, we have discussed Clear-Item cmdlet in PowerShell.

https://cloudaffaire.com/powershell-clear-item-cmdlet/

In this blog post, we will discuss Rename-Item cmdlet in PowerShell. You can use Rename-Item cmdlet to rename a registry key name, file name or directory name in PowerShell. Rename-Item cmdlet only renames the item but does not changes it path. If you want to rename the item and change its path, use Move-Item cmdlet.

Rename-Item Cmdlet Syntax:

Rename-Item Cmdlet Argument List:

  • Confirm: Prompts you for confirmation before running the cmdlet.
  • Credential: To impersonate another user or elevate your credentials.
  • Force: Forces the cmdlet to remove items that cannot otherwise be changed, such as hidden or read-only files or read-only aliases or variables.
  • LiteralPath: Specifies a path to one or more locations. The value of LiteralPath is used exactly as it is typed. No characters are interpreted as wildcards.
  • Path: Specifies a path of the items being removed. Wildcard characters are permitted.
  • PassThru: Returns an object that represents the item to the pipeline. By default, this cmdlet does not generate any output.
  • NewName: Specifies the new name of the item. Enter only a name, not a path and name.
  • UseTransaction: Includes the command in the active transaction. This parameter is valid only when a transaction is in progress.
  • WhatIf: Shows what would happen if the cmdlet runs. The cmdlet is not run.

PowerShell Rename-Item Cmdlet:

Rename A Registry Key In PowerShell:

Rename A Directory In PowerShell:

Rename Multiple Directories At Once In PowerShell:

Rename A File In PowerShell:

Rename Multiple Files At Once In PowerShell:

Hope you have enjoyed this article. In the next blog post, we will discuss Get-Item cmdlet in PowerShell.

To get more details on PowerShell, kindly follow below official documentation

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about?view=powershell-5.1

 

Leave a Reply