Rename-Item

 

Additional Resources for Rename-Item

 

Renaming a File or Folder

http://www.microsoft.com/technet/scriptcenter/topics/msh/cmdlets/rename-item.mspx

 

 

SYNOPSIS

Renames an item in a Windows PowerShell provider namespace.

 

SYNTAX

Rename-Item [-path] <string> [-newName] <string> [-force] [-passThru] [-credential <PSCredential>] [-whatIf] [-confirm] [<CommonParameters>]

 

DETAILED DESCRIPTION

Renames an item in a Windows PowerShell provider namespace. Using this cmdlet does not affect the content of the item being renamed.

 

PARAMETERS

 

-path <string>

Specifies the path to the item to rename.

 

Required?

true

Position?

1

Default value

<current location>

Accept pipeline input?  

true (ByValue, ByPropertyName)

Accept wildcard characters? 

true

 

-newName <string>

Specifies the new name of the item.

 

Required?

true

Position?

2

Default value

N/A - The name must be specified

Accept pipeline input?  

true (ByPropertyName)

Accept wildcard characters? 

false

 

-force <SwitchParameter>

Allows the cmdlet to override restrictions to renaming files as long as security is not compromised.

 

Required?

false

Position?

named

Default value

False

Accept pipeline input?  

false

Accept wildcard characters? 

false

 

-passThru <SwitchParameter>

Passes the object created by this cmdlet along the pipeline. By default, this cmdlet does not pass objects along the pipeline.

 

Required?

false

Position?

named

Default value

False

Accept pipeline input?  

false

Accept wildcard characters? 

false

 

-credential <PSCredential>

Uses a credential to validate access. You can specify a PSCredential object obtained by using get-credential or, if a user name is supplied, you will be prompted for a password.

 

Required?

false

Position?

named

Default value

 

Accept pipeline input?  

true (ByPropertyName)

Accept wildcard characters? 

false

 

-whatIf

Describes what would happen if you executed the command without actually executing the command.

 

Required?

false

Position?

named

Default value

 

Accept pipeline input?  

false

Accept wildcard characters? 

false

 

-confirm

Prompts you for confirmation before executing the command.

 

Required?

false

Position?

named

Default value

 

Accept pipeline input?  

false

Accept wildcard characters? 

false

 

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, and -OutVariable. For more information, type, "get-help about_commonparameters".

 

INPUT TYPE

String

 

NOTES

 

For more information, type "Get-Help Rename-Item  -detailed". For technical information, type "Get-Help Rename-Item -full".

 

When specifying multiple values for a parameter, use commas to separate the values. For example, "<parameter-name> <value1>, <value2>".

 

EXAMPLE 1

 

rename-item -path c:\logfiles\daily_file.txt -newname monday_file.txt

 

This command renames the file daily_file.txt to monday_file.txt.

 

RELATED LINKS

Clear-Item

Invoke-Item

Move-Item

Set-Item

New-Item

Remove-Item

Get-Item

Copy-Item

about_namespace