If you're doing this for a lot of computers, then you don't want to do it from the command line, you want to setup a "Folder Redirection" group policy, and that will do it all for you.
However I assume that you're just doing this for your own PC, the easiest way is probably via the registry keys for the User's Shell Folders. For example, your My Documents folder location should be held in the
Personal value in
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders.
From the command line, you could use the
reg.exe tool to change that using a command like:
reg ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Personal /t REG_EXPAND_SZ /d "D:\My Documents"
However, doing this through the GUI (as in your question) or using Group Policies are the supported ways to do it. Poking values into registry keys as I've explained above should not be attempted unless you really know what you're doing, and can handle the consequences of getting it wrong.