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