Command-line arguments is part of Short Circuit's Console Program Basics selection.
Scripted main
See also Program name.

For parsing command line arguments intelligently, see Parsing command-line arguments.

Example command line:

myprogram -c "alpha beta" -h "gamma"

let () =
  Printf.printf "This program is named %s.\n" Sys.argv.(0);
  for i = 1 to Array.length Sys.argv - 1 do
    Printf.printf "the argument #%d is %s\n" i Sys.argv.(i)
  done