Anybody know how to test if a replaceable parameter is a directory? if exist %1 returns true only if %1 is a <i>file</i>, not a directory.

I need to write a batch file that reacts differently if %1 represents a null, a file, a directory, or anything else (i.e., if it's not "", and it's not a file or directory, it creates a new direcotory named %1)

Also, anybody know how to extract filenames from a dir statement? I have to write another batch file which uses TYPE to display the contents of all read-only files.
i.e.

:startloop
if "%1" == "" goto end
type %1
shift
goto startloop

:end