Basics with Windows Power Shell by Prometheus MMS - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

2.4 Renaming a File or Folder

What can you do with the Rename-Item cmdlet? Well, one thing you can do is rename files or folders; all you have to do is call Rename-Item followed by two parameters:

The current path for the file or folder.

The new name for the file or folder.

For example, this command renames the file C:\Scripts\Test.txt to

C:\Scripts\New_Name.txt:

Rename-Item c:\scripts\test.txt new_name.txt

Rename-Item Aliases

rni

ren