Windows – how to set $HOME variable so that cmd find the path

command lineenvironment-variableswindows 10

Regardless of what directory I am at, for instance, when type in cd ~/Documents/project in git bash, it works. Whereas, it will not work doing the same in the cmd. It says: the system cannot find the path specified.

I have searched for how to get the $Home variable in the cmd to work but there are many different answers and all of them quite old. Any ideas how to fix it?

Best Answer

Doing the same in the cmd. It says: the system cannot find the path specified.

cd ~/Documents/project

cmd does not understand ~ expansion as it is not bash compatible.

cmd also does not use $HOME. Instead it uses %HOMEDRIVE% and %HOMEPATH%

You can set a new environment variable %HOME% as appropriate for your needs and then use:

cd %HOME%

Further Reading

Related Question