For the directory vs file thing, I can only think to try cd %1 and test for an errorlevel.

I don't think DOS supported any sort of regular expressions or output manipulation. I'd just as soon try it in C.

In newer DOS versions, dir /b will show filenames plain, 1 per line. Type dir /? for details.