Move

Move file (mv, move, mi)

Move-Item src.txt dst.txt

Move file:

move src.txt dst.txt

Renames (effectively moves) a file within the same directory.

Not applicable for moving to different directories.

ren C:\source\file.txt C:\destination\file.txt

Uses Robocopy to move a file by copying it to the destination and then deleting it from the source.

robocopy C:\source C:\destination file.txt /MOV

Moves a file using .NET's System.IO.File class in a PowerShell script.

[System.IO.File]::Move("C:\source\file.txt", "C:\destination\file.txt")

Moves a file by copying it with attributes and then deleting the source file.

Note: This is technically a copy operation followed by a delete, but achieves the move effect.

xcopy C:\source\file.txt C:\destination\file.txt /O /X /Y /H /K && del C:\source\file.txt

Last updated

Was this helpful?