Is there a shortcut command in Windows command prompt to get to the current user's home directory like there is in Linux?
Yes, you can use %HOMEPATH%
, and %HOMEDRIVE%
. These contain the full path of the user's home directory (without drive letter), and the drive letter, respectively.
There are quite a few other useful variables available, such as %OS%
(Operating System), or %WINDIR%
(Windows system directory). See Wikipedia: Environment Variables for a list.
Notes:
Actually, things are a bit complicated (as usual). There is also%USERPROFILE%
, which does contain the drive letter, and is usually the same directory as %HOMEPATH%
plus %HOMEDRIVE%
.
The values of these variables, and which one is right for you, will depend on the Windows version and any changes by an administrator, as their values may be different (see e.g. the question Difference between profile and home path ).
Two other options both of which can be added to a script and auto-executed in a similar manner to BillP3rd's answer.
It's two more characters but...
SET ~=%HOMEPATH%
CD %~%
or...
CD %~%\Desktop
Or...
doskey ~=cd %homepath%
~
Of course you can't use this ~
in paths but as a quick "jump to my home dir" typing ~
Enter is pretty quick.
You can always put a .bat
file somewhere in your %PATH%
which does the path changing for you.