If you don't mind doing a little more typing and a little less mouse clicking, you can perform a lot of actions from the command line. (Displaying the Command Prompt window is covered under another tip.) One thing you can do from the command line is to move files. The command-line command you use is MOVE and it takes two (or more) parameters. The first parameter specifies the file you want moved and the second parameter specifies to where the file should be moved.
So, let's say you have a file called "C:\Temp\BatFun.bat" and you want to move it to C:\Bat\BatFun.bat You would type the following at the command line:
C:\> MOVE C:\Temp\BatFun.bat C:\Bat\BatFun.bat
The BatFun.bat file in the \Temp directory will be moved to the \Bat directory. It will no longer exist in the C:\Temp directory, which is the main difference between COPY and MOVE. (See the tip titled Moving Files Using the Command Line for details of the COPY command.) Of course, you can specify whatever name you like for the destination, so you may have a \Temp\BatFun.bat file that you're developing and testing, but once you're satisfied with it you may want to move it to your \Bat directory and give it the name of DirList.bat. This is accomplished by just changing the name of the destination parameter:
C:\> MOVE C:\Temp\BatFun.bat C:\Bat\DirList.bat
You can use wildcard characters to move multiple files at a time. So, let's say you have several .bat files in your \Temp directory that are supposed to work together, and you want to move them all to your \Bat directory. Maybe the files are named C:\Temp\Dir1.bat, C:\Temp\Dir2.bat, and C:\Temp\Dir3.bat. To move them all to your \Bat directory the command would be:
C:\> MOVE C:\Temp\Dir?.bat C:\Bat
The wildcard character "?" stands for exactly one actual character in the source parameter. Note that you didn't need to specify anything except the destination directory (without the trailing backslash) as the second parameter. This is because MOVE will automatically use the file name specified by the first parameter as the file name to be used in the \Bat directory. In other words, you'll end up with a Dir1.bat, Dir2.bat, and Dir3.bat in your C:\Bat directory.
The MOVE command is similar to the COPY command but with two main differences:
This tip (13101) applies to Windows 7, 8, and 10.
Corrupt or unwanted Address Resolution Protocol (ARP) cache entries can cause connectivity errors. Here is how to flush ...
Discover MoreDisplaying all the files a folder contains is an easy task in Windows. One way you can display the files is using command ...
Discover MoreThe copy command can be a timesaver over trying to do the similar sort of thing with Windows Explorer. You can copy ...
Discover More2021-02-15 15:14:57
Dan A. Peters
I think you made a typo that may be a little confusing to your readers.....
Ref, "Moving Files Using the Command Line" article, you say...
...See the tip titled Moving Files Using the Command Line for details of the COPY command... but the word, "Moving" should be "Copying" because when you select the link, the "Copying Files Using the Command Line" article is displayed.
Sincerely,
Dan
Copyright © 2024 Sharon Parq Associates, Inc.
Comments