the function to execute mcmd.