Renaming files, folders, registry keys, and named values

When you are working with PowerShell scripts, you may have instances where you need to rename files, folders, and registry keys. The rename-item cmdlet can be used to perform renaming operations on a system. The syntax for this cmdlet is rename-item and specifying the –path argument with path to the original object, and then you call the –newname argument with a full path to what you want the item to be renamed to. The rename-item has a –force argument to force the rename in instances where the file or folder is hidden or restricted by UAC or to avoid prompting for the rename action.

To copy and rename files and folders, do the following action:

New-item –path "c:\Program Files\MyCustomSoftware\OldConfigFiles\" ...

Get PowerShell: Automating Administrative Tasks now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.