Here's a quick explanation:
The "rd" command deletes an empty directory. In Windows NT, if you use the "/s" switch, it'll delete a directory and all of the files in it. If you add the "/q" switch, it'll do so without prompting.
The "for" command allows you to create loops that work by cycling through files, cycling through directories (either recursively or not), going through a set of numbers, or processing a text file and pulling tokens from that. When using the "/d" switch with the set "*", it cycles through all of the directories in the current one.
"for" works by putting each matching token into a variable and allowing you to do whatever you like with it in your command (which is specified after "do"). In this particular case, "d" is the variable.
So, basically, "for /d %d in (*) do rd /s /q %d" cycles through all of the directories names in the location that you ran the command from and passes them to the "rd" command for deletion. It does have some limitations, though. It doesn't delete directories with the "hidden" bit set, it doesn't traverse backwards through the directory structure (basically, it won't follow ".." -- i.e. going back to the previous directory -- and wipe out the entire drive), and it doesn't delete the files in the directory that it's run from.