What is the alternative for ~ (user's home directory) on Windows command prompt?

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 %HOMEDRIVE%%HOMEPATH% for the drive + \docs settings\username or \users\username.


You can use %homedrive%%homepath% environment variable to accomplish this.

The two command variables when concatenated gives you the desired user's home directory path as below:

  1. Running echo %homedrive% on command prompt gives:

    C:
    
  2. Running echo %homepath% on command prompt gives:

    \Users\<CurrentUserName>
    

When used together it becomes:

C:\Users\<CurrentUserName>