Try like this:
@echo off
FOR %%a IN (%*) DO (
if exist %%a\ (
set DRVPATH="%%~fa"
set FILEEXT=NIL
) else (
if exist %%a (
set DRVPATH="%%~pa"
set FILEEXT="%%~nxa"
)
)
)
echo DRVPATH: %DRVPATH%
echo FILEEXT: %FILEEXT%
pause
If a directory with the name you drop exist then the var %FILEEXT%
is set to NIL
.