FOR %%A IN (%*) DO ( IF "%%A"=="/r" ECHO You passed the /r flag. )
:processargs SET ARG=%1 IF DEFINED ARG ( IF "%ARG%"=="/r" ECHO You passed the /r flag. SHIFT GOTO processargs )