Move Files with Powershell and CMD (examples)!
The solution is quite easy to move with Powershell and / or cmd.exe files, or folders, here with examples!
Moving files sometimes makes more sense at the command line than with Microsoft File Explorer or Quad Explorer , it makes perfect sense because of the wildcard (placeholder) file function. This is not only possible under Windows 10 / 8.1 / 7. No! It is also popular by administrators used feature, especially on Windows Server 2016 and 2012 R2 (Web Server).
1.) ... Move the data with the command prompt (cmd.exe)
2.) ... Moving the data using PowerShell!
3.) ... What should I consider when move files by command line!
4.) ... Overview of the MOVE commands!
1.) Move the data with the command prompt (cmd.exe)
At the Windows command prompt, you can move files with the move command (folder and files). For example, if you want to move a file named "text_file.xls" to the "C: \Folder1" folder , type the following command:
move test_file.xls C:\Folder1
Do not forget to press Enter.
Here, we move the file from the current working directory to C:\Folder1.
However, if you want to move from a specific folder, you must specify the full folder path, which should also be noted if the destination or source directory is stored in the folder folder. Path include spaces, must be used "" quotes (quotation marks).
Here is a simple example:
move "D:\Test Folder\test_file.xls" C:\Folder1
You can also move multiple files using wildcards. In the example below, the move command moves all files with the file extension *.xls to the "C:\folder 2" directory .
move "D:\Test Folder\*.xls" "C:\Folder 2"
If executed correctly, you will see how many files have been moved!
2.) Moving the data using PowerShell!
Even with Powershell you can move files and folders! The MOVE command can also be used in the powershell console. However, this is not the Powershell home-made move command!
move "D:\Test Folder\*.xls" "C:\Folder 2"
That would be the correct Powershell command but MOVE is much more elegant in this case
D:\>Get-ChildItem "D:\From-Folder\*.xls" -Recurse | Move-Item -Destination "C:\Dest-Folder"
3.) What should I consider when move files by command line!
Unlike the file explorer, actions can not be reversed, so you have to be clear about what you are moving. "Undo move" make is not here!
Otherwise, quite handy the move by command line under Microsoft's Windows.
4.) Overview of the MOVE commands!
ColorConsole [Version 2.6.1001 ]
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
Moves files and renames files and directories.
To move one or more files:
MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination
To rename a directory:
MOVE [/Y | /-Y] [drive:][path]dirname1 dirname2
Specifies the location and name of the file
or files you want to move.
Specifies the new location of the file. Destination
can consist of a drive letter and colon, a
directory name, or a combination. If you are moving
only one file, you can also include a filename if
you want to rename the file when you move it.
Specifies the directory you want to rename.
Specifies the new name of the directory.
Suppresses prompting to confirm you want to
overwrite an existing destination file.
Causes prompting to confirm you want to overwrite an existing destination file.
The switch /Y may be present in the COPYCMD environment variable.
This may be overridden with /-Y on the command line. Default is
to prompt on overwrites unless MOVE command is being executed from
within a batch script.
You can safely use this on the following operating systems: Windows 10 (Redstone 4 & 5) Pro, Enterprise, Home, Windows 8.1, Windows 8, Windows-Server 2016, 2012, 2008, Windows 7 Basic, Professional, Starter, Ultimate and all commands for free!
FAQ 30: Updated on: 22 June 2018 10:36
Windows-Console - FAQ-30: Move Files with Powershell and CMD (examples)!
ist valid for Microsoft (c): Windows 10
: Pro, Enterprise, Home,
Windows and 8.1
: Enterprise, Pro, Home
: Enterprise, Home, Basic, Premium, Professional, Starter, Ultimate
Windows-Server 2016, 2012, 2008, 2005 .
Keywords: windows, console, move, files, with, powershell, examples, cmd, solution, folders, moving, more, sense, Questions, Answers, Software