Heres a simplified version of what I'm after:
SET outFile=
IF "%outFile%"=="" (
echo Output file=[Console]
SET outFile=CON
) ELSE (
IF "%outFile:~0,3%"=="%HOMEDRIVE%\" (
echo Output file=%outFile%
SET outFile=%outFile%
) ELSE (
echo Output file=%cd%\%outFile%
SET outFile=%cd%\%outFile%
)
)
It works in all conditions except for outFile being empty which returns the error "( was unexpected at this time."