I\'m trying to use the command prompt to move some files,
I am used to the linux terminal where I use ~
to specify the my home directory
I\'ve looked everywhere
You can %HOMEDRIVE%%HOMEPATH% for the drive + \docs settings\username
or \users\username
.
I just tried set ~=%userprofile%
and that works too if you want to keep using the same habit
You can then use %~%
instead.
If you want a shorter version of Jay's you could try
set usr=%userprofile%
cd %usr%
Or you could even use %u% if you wanted to. It saves some keystrokes anyway.
You can also do cd ......\ as many times as there are folders that takes you to home directory. For example, if you are in cd:\windows\syatem32, then cd ....\ takes you to the home, that is c:\
You're going to be disappointed: %userprofile%
You can use other terminals, though. Powershell, which I believe you can get on XP and later (and comes preinstalled with Win7), allows you to use ~
for home directory.
You can use %systemdrive%%homepath%
environment variable to accomplish this.
The two command variables when concatenated gives you the desired user's home directory path as below:
Running echo %systemdrive%
on command prompt gives:
C:
Running echo %homepath%
on command prompt gives:
\Users\<CurrentUserName>
When used together it becomes:
C:\Users\<CurrentUserName>