Is there a command to change path from current location to default directory, in Windows command prompt?

There's no option built into cd to do this but you could certainly create a .cmd script file that does it. For example, you could put this into a home.cmd file somewhere on your search PATH and go to D:\Abc just by typing home:

@ echo off
cd /D D:\Abc

There's no in-built command, but why not create your own, for example dd (Default Directory)? Just save the following command in a batch/script file in any location, say C:\Macros.bat or C:\Macros.cmd:

@doskey dd=cd /d D:\Abc

Now in the registry (Regedit.exe) navigate to:

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor

Create a string value (REG_SZ) or expandable string value (REG_EXPAND_SZ) called AutoRun and set it to C:\Macros.bat (or .cmd as the case may be).

The same AutoRun value can also be added to:

HKEY_CURRENT_USER\Software\Microsoft\Command Processor

Any commands specified in the HKLM AutoRun value will run before those in the HKCU counterpart. See cmd /? for more.

Now whenever you open a cmd.exe instance/window, Macros.bat (or .cmd) will be executed automatically and the DOSKey command alias will be (re)created as a result. So you can simply type your new command dd to jump to the specified default directory.


cd %HOMEPATH%

Although creating a batch file as Nicole mentions is probably easier.