Your current location is important when using commands in cmd
. Though you can use absolute paths to avoid needing to worry about your current folder, which is often important in batch files.
Absolute Paths
For example, if your file is located here:
C:\users\julio\desktop\testfolder\testfile.txt
Then this command will work from anywhere on the c: drive:
move C:\users\julio\desktop\testfolder\testfile.txt C:\users\julio\desktop\
These are called absolute paths because you are saying exactly where the source and destinations are.
Relative Paths
Relative paths are much more convenient to use when at the command prompts. There are two key shortcuts you should be aware of:
This refers to the parent directory of the one you are in:
..
This refers to the current directory:
.
So, if you aleady in the C:\users\julio\desktop\testfolder\
and you want to move testfile.txt
up one level to the parent folder: C:\users\julio\desktop\
, then you can use this shortcut:
move testfile.txt ..
This means "move the testfile.txt
from the current folder to its parent folder".
On the otherhand, if you were already in the C:\users\julio\desktop
folder, you can do this:
move testfolder\testfile.txt .
This means "move the file testfile.txt
from the folder testfolder
which is directly below my current location, to my current location."
Your current location is generally in your prompt.
I don't believe it has been said in the answers, the reason that renames the file is because the move command renames when you use it inside the same folder. – SomeNickName – 2015-08-26T20:23:21.180