for no.3 you could
exec("myprogram.exe",""); get it to recall itself and clse down the original so all command line options are ignored except the one's you've preset in code

or you could get it to close if ones have been defined in the command options without specific requirements that you don't want to automatically close

Code:
function main(){
	ifdef server; //if it's server
		ifndef defServer; //if -d defServer hasn't been defined in command option
			exit; //close automatically
		endif;
	ifelse; //else check other things you might want

	endif;
}

Hope this helps

e.g