Powershell - Rename File



Cmdlet

Rename-Item cmdlet is used to rename a File by passing the path of the file to be renamed and target name.

Example 1

In this example, we'll rename a folder D:\Temp\Test\test.txt to test1.txt

Type the following command in PowerShell ISE Console

Rename-Item D:\temp\Test\test.txt test1.txt

You can see the test.txt renamed to test1.txt in Windows explorer.

powershell_files_folders.htm
Advertisements