command_argument_count returns the number of arguments passed on the command line when the containing program was invoked.
Fortran 2003 and later
result = command_argument_count()
None
The return value is of type integer(4)
program test_command_argument_count
    integer :: count
    count = command_argument_count()
    print *, count
end program test_command_argument_count
get_command, get_command_argument