I use following command to copy files to folders with same name.
for /f %x in ('dir /ad /b') do move %x*.* %x\
I use move %x*.* %x to move the files to given directory. It doesn't work for files, which has spaces in their filenames, but not sure what to change. I already tried to use quotes around arguments, but doesn't helped.