|DIR should be recognized... It included in every for of windows I believe.|
What it does is list all the files in that directory. Try a reboot, occasionally when you install certain programs it screws with your path variable a little. If it's still not working check your system32 folder and look for dir.exe.
"P:\ath\of\files" needs to be changed though to the actual location of the files that need sorting.
EDIT: Do what I said above, but recopy the code I pasted earlier. I made a mistake, that is fixed now.
Can I put a question here?