Until today, I also did not have an idea about the difference between these two.
%cd% available to a batch file or at the command prompt and expands to the drive letter and the path of the current directory.
%~dp0 is available to a batch file only. This expands to the drive letter and the path in which the batch file is located.
If you take the following command for an example where the batch file prints the two variables, the output would be as shown.
%cd% = C:\danushka\runtime
%~dp0 = D:\my_scripts