John, In your bat file, you have the following comparison:
if NOT [%~x1]==[.dwg] goto endmark
It's failing if the extension is .DWG. I can't find a syntax to compare both versions.
To do that we'd need a logical OR (and I'm pretty sure batch script doesn't have that for this case). ...yuck. But, let's try a chain of IF's.
Try replacing that line with these and see what happens (I'm typing blind here so bear with me, please).
set end=T
if [%~x1]==[.dwg] set end=F
if [%~x1]==[.DWG] set ent=F
if "%end%"=="T" goto endmark
We start off by assuming we need to "END" so we add a few IF statements to prove that we can continue. This (chained IF's) should represent a OR condition.
However, I wonder if we could just nest the IFs and get the same results without the need for a variable.
if NOT [%~x1]==[.dwg] if NOT [%~x1]==[.DWG] goto endmark