Skip to main content

Move a File or Directory in PowerShell

Problem

You want to move a file or directory.

Solution

To move a file or directory, use the MoveItem cmdlet: PS >MoveItem example.txt c:\temp\example2.txt

Discussion

The MoveItem cmdlet moves an item from one location to another. Like the other *Item cmdlets, the MoveItem doesn’t work only against the filesystem. Any providers that support the concept of items automatically support this cmdlet as well.

The MoveItem cmdlet lets you specify multiple files through its Path, Include, Exclude, and Filter parameters.

Although the MoveItem cmdlet works in every provider, you cannot move items between providers. For more information about the MoveItem cmdlet, type GetHelp MoveItem.

Help Category