Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 1.0 » Move-Item

Move-Item - Powershell 1.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »

Move-Item

Description
Move an item from one location to another

Usage


Options


Example(s)
Move and rename a file:

PS C:\>Move-Item -path C:\SS64.txt -destination E:\work\tst.txt

Move a directory, and all of its subdirectories and files:

PS C:\>Move-Item -path C:\Temp -destination C:\Logs

Move all the .TXT files in the current directory, represented by a dot (.)

PS C:\>Move-Item -path .\*.txt -destination C:\Logs

Use Get-Childitem to retrieve all .doc files from the current directory (.) and all subdirectories and move them to a single directory:

PS C:\>Get-Childitem . -recurse -include *.doc | move-item -dest C:\mydocs

    If any of the files being moved share the same name, Move-Item will display an error and continue, but will move only one file with each name, the other files remain in their original directories.
    By default, Get-Childitem will not select hidden files unless you specify -Force

Move registry keys and values:

PS C:\>Move-Item hklm:\software\SS64\* hklm:\software\TEST

    The wildcard (*) indicates that the contents of the SS64 key should be moved, but not the key itself.

Move a directory name that includes wildcard characters:

PS C:\>Move-Item -literalpath 'C:\folder_with[reserved`chars]' -destination C:\myDocs